nfsd4: delay setting current filehandle till success
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 27 Jan 2012 21:26:02 +0000 (16:26 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 6 Mar 2012 23:13:36 +0000 (18:13 -0500)
Compound processing stops on error, so the current filehandle won't be
used on error.  Thus the order here doesn't really matter.  It'll be
more convenient to do it later, though.

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

index cdb7ca3371874d32b7f4752203cfd2eee5648ba8..bdb71a57c94eb6f3de1366cbc7304d5b34375226 100644 (file)
@@ -247,16 +247,14 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
        if (is_create_with_attrs(open) && open->op_acl != NULL)
                do_set_nfs4_acl(rqstp, &resfh, open->op_acl, open->op_bmval);
 
-       set_change_info(&open->op_cinfo, current_fh);
-       fh_dup2(current_fh, &resfh);
-
        /* set reply cache */
        fh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh,
                        &resfh.fh_handle);
        if (!open->op_created)
-               status = do_open_permission(rqstp, current_fh, open,
+               status = do_open_permission(rqstp, &resfh, open,
                                            NFSD_MAY_NOP);
-
+       set_change_info(&open->op_cinfo, current_fh);
+       fh_dup2(current_fh, &resfh);
 out:
        fh_put(&resfh);
        return status;