nfsd4: process_open2 cleanup
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 7 Jun 2012 21:30:45 +0000 (17:30 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 20 Jun 2012 12:59:43 +0000 (08:59 -0400)
Note we can simplify the error handling a little by doing the truncate
earlier.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c

index de8f7e45102d6d5c3455c3c4f509144785599b7f..9efa4055b5a801a5d35d5b5706d9392a9e5bb9d1 100644 (file)
@@ -3011,16 +3011,14 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
                        goto out;
        } else {
                status = nfs4_get_vfs_file(rqstp, fp, current_fh, open);
+               if (status)
+                       goto out;
+               status = nfsd4_truncate(rqstp, current_fh, open);
                if (status)
                        goto out;
                stp = open->op_stp;
                open->op_stp = NULL;
                init_open_stateid(stp, fp, open);
-               status = nfsd4_truncate(rqstp, current_fh, open);
-               if (status) {
-                       release_open_stateid(stp);
-                       goto out;
-               }
        }
        update_stateid(&stp->st_stid.sc_stateid);
        memcpy(&open->op_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));