Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfashe...
[powerpc.git] / fs / nfsd / nfs4proc.c
index 0a7bbdc..50bc942 100644 (file)
@@ -93,6 +93,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
 {
        struct svc_fh resfh;
        __be32 status;
+       int created = 0;
 
        fh_init(&resfh, NFS4_FHSIZE);
        open->op_truncate = 0;
@@ -105,28 +106,27 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
                status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data,
                                        open->op_fname.len, &open->op_iattr,
                                        &resfh, open->op_createmode,
-                                       (u32 *)open->op_verf.data, &open->op_truncate);
-       }
-       else {
+                                       (u32 *)open->op_verf.data, &open->op_truncate, &created);
+       } else {
                status = nfsd_lookup(rqstp, current_fh,
                                     open->op_fname.data, open->op_fname.len, &resfh);
                fh_unlock(current_fh);
        }
+       if (status)
+               goto out;
 
-       if (!status) {
-               set_change_info(&open->op_cinfo, current_fh);
+       set_change_info(&open->op_cinfo, current_fh);
 
-               /* set reply cache */
-               fh_dup2(current_fh, &resfh);
-               open->op_stateowner->so_replay.rp_openfh_len =
-                       resfh.fh_handle.fh_size;
-               memcpy(open->op_stateowner->so_replay.rp_openfh,
-                               &resfh.fh_handle.fh_base,
-                               resfh.fh_handle.fh_size);
+       /* set reply cache */
+       fh_dup2(current_fh, &resfh);
+       open->op_stateowner->so_replay.rp_openfh_len = resfh.fh_handle.fh_size;
+       memcpy(open->op_stateowner->so_replay.rp_openfh,
+                       &resfh.fh_handle.fh_base, resfh.fh_handle.fh_size);
 
+       if (!created)
                status = do_open_permission(rqstp, current_fh, open, MAY_NOP);
-       }
 
+out:
        fh_put(&resfh);
        return status;
 }