This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / fs / nfsd / nfs4proc.c
index ff6240f..2967d4d 100644 (file)
@@ -161,6 +161,9 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
 }
 
 
+/*
+ * nfs4_unlock_state() called in encode
+ */
 static inline int
 nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
 {
@@ -179,6 +182,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
        if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
                return nfserr_inval;
 
+       open->op_stateowner = NULL;
        nfs4_lock_state();
 
        /* check seqid for replay. set nfs4_owner */
@@ -197,7 +201,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
                        status = NFSERR_REPLAY_ME;
        }
        if (status)
-               goto out;
+               return status;
        if (open->op_claim_type == NFS4_OPEN_CLAIM_NULL) {
        /*
         * This block of code will (1) set CURRENT_FH to the file being opened,
@@ -207,7 +211,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
         */
                status = do_open_lookup(rqstp, current_fh, open);
                if (status)
-                       goto out;
+                       return status;
        } else if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) {
        /*
        * The CURRENT_FH is already set to the file being opened. This
@@ -217,11 +221,10 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
        */
                status = do_open_fhandle(rqstp, current_fh, open);
                if (status)
-                       goto out;
+                       return status;
        } else {
                printk("NFSD: unsupported OPEN claim type\n");
-               status = nfserr_inval;
-               goto out;
+               return nfserr_inval;
        }
        /*
         * nfsd4_process_open2() does the actual opening of the file.  If
@@ -229,11 +232,9 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
         * set, (2) sets open->op_stateid, (3) sets open->op_delegation.
         */
        status = nfsd4_process_open2(rqstp, current_fh, open);
-out:
-       if (open->op_stateowner)
-               nfs4_get_stateowner(open->op_stateowner);
-       nfs4_unlock_state();
-       return status;
+       if (status)
+               return status;
+       return 0;
 }
 
 /*
@@ -784,7 +785,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
        struct nfsd4_op *op;
        struct svc_fh   *current_fh = NULL;
        struct svc_fh   *save_fh = NULL;
-       struct nfs4_stateowner *replay_owner = NULL;
        int             slack_space;    /* in words, not bytes! */
        int             status;
 
@@ -864,7 +864,9 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
                        break;
                case OP_CLOSE:
                        op->status = nfsd4_close(rqstp, current_fh, &op->u.close);
-                       replay_owner = op->u.close.cl_stateowner;
+                       if (op->u.close.cl_stateowner)
+                               op->replay =
+                                       &op->u.close.cl_stateowner->so_replay;
                        break;
                case OP_COMMIT:
                        op->status = nfsd4_commit(rqstp, current_fh, &op->u.commit);
@@ -883,14 +885,18 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
                        break;
                case OP_LOCK:
                        op->status = nfsd4_lock(rqstp, current_fh, &op->u.lock);
-                       replay_owner = op->u.lock.lk_stateowner;
+                       if (op->u.lock.lk_stateowner)
+                               op->replay =
+                                       &op->u.lock.lk_stateowner->so_replay;
                        break;
                case OP_LOCKT:
                        op->status = nfsd4_lockt(rqstp, current_fh, &op->u.lockt);
                        break;
                case OP_LOCKU:
                        op->status = nfsd4_locku(rqstp, current_fh, &op->u.locku);
-                       replay_owner = op->u.locku.lu_stateowner;
+                       if (op->u.locku.lu_stateowner)
+                               op->replay =
+                                       &op->u.locku.lu_stateowner->so_replay;
                        break;
                case OP_LOOKUP:
                        op->status = nfsd4_lookup(rqstp, current_fh, &op->u.lookup);
@@ -905,15 +911,21 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
                        break;
                case OP_OPEN:
                        op->status = nfsd4_open(rqstp, current_fh, &op->u.open);
-                       replay_owner = op->u.open.op_stateowner;
+                       if (op->u.open.op_stateowner)
+                               op->replay =
+                                       &op->u.open.op_stateowner->so_replay;
                        break;
                case OP_OPEN_CONFIRM:
                        op->status = nfsd4_open_confirm(rqstp, current_fh, &op->u.open_confirm);
-                       replay_owner = op->u.open_confirm.oc_stateowner;
+                       if (op->u.open_confirm.oc_stateowner)
+                               op->replay =
+                                       &op->u.open_confirm.oc_stateowner->so_replay;
                        break;
                case OP_OPEN_DOWNGRADE:
                        op->status = nfsd4_open_downgrade(rqstp, current_fh, &op->u.open_downgrade);
-                       replay_owner = op->u.open_downgrade.od_stateowner;
+                       if (op->u.open_downgrade.od_stateowner)
+                               op->replay =
+                                       &op->u.open_downgrade.od_stateowner->so_replay;
                        break;
                case OP_PUTFH:
                        op->status = nfsd4_putfh(rqstp, current_fh, &op->u.putfh);
@@ -972,17 +984,12 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
 
 encode_op:
                if (op->status == NFSERR_REPLAY_ME) {
-                       op->replay = &replay_owner->so_replay;
                        nfsd4_encode_replay(resp, op);
                        status = op->status = op->replay->rp_status;
                } else {
                        nfsd4_encode_operation(resp, op);
                        status = op->status;
                }
-               if (replay_owner && (replay_owner != (void *)(-1))) {
-                       nfs4_put_stateowner(replay_owner);
-                       replay_owner = NULL;
-               }
        }
 
 out: