Merge tag 'for-linus-4.3-merge-window-part-1' of git://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / fs / nfsd / nfs4proc.c
index 90cfda7..4ce6b97 100644 (file)
@@ -276,13 +276,13 @@ do_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, stru
                        nfsd4_security_inode_setsecctx(*resfh, &open->op_label, open->op_bmval);
 
                /*
-                * Following rfc 3530 14.2.16, use the returned bitmask
-                * to indicate which attributes we used to store the
-                * verifier:
+                * Following rfc 3530 14.2.16, and rfc 5661 18.16.4
+                * use the returned bitmask to indicate which attributes
+                * we used to store the verifier:
                 */
-               if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0)
-                       open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS |
-                                                       FATTR4_WORD1_TIME_MODIFY);
+               if (nfsd_create_is_exclusive(open->op_createmode) && status == 0)
+                       open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS |
+                                               FATTR4_WORD1_TIME_MODIFY);
        } else
                /*
                 * Note this may exit with the parent still locked.
@@ -362,7 +362,6 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 {
        __be32 status;
        struct svc_fh *resfh = NULL;
-       struct nfsd4_compoundres *resp;
        struct net *net = SVC_NET(rqstp);
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
@@ -389,8 +388,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                copy_clientid(&open->op_clientid, cstate->session);
 
        /* check seqid for replay. set nfs4_owner */
-       resp = rqstp->rq_resp;
-       status = nfsd4_process_open1(&resp->cstate, open, nn);
+       status = nfsd4_process_open1(cstate, open, nn);
        if (status == nfserr_replay_me) {
                struct nfs4_replay *rp = &open->op_openowner->oo_owner.so_replay;
                fh_put(&cstate->current_fh);
@@ -417,10 +415,10 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
        /* Openowner is now set, so sequence id will get bumped.  Now we need
         * these checks before we do any creates: */
        status = nfserr_grace;
-       if (locks_in_grace(net) && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
+       if (opens_in_grace(net) && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
                goto out;
        status = nfserr_no_grace;
-       if (!locks_in_grace(net) && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
+       if (!opens_in_grace(net) && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
                goto out;
 
        switch (open->op_claim_type) {
@@ -829,7 +827,7 @@ nfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 {
        __be32 status;
 
-       if (locks_in_grace(SVC_NET(rqstp)))
+       if (opens_in_grace(SVC_NET(rqstp)))
                return nfserr_grace;
        status = nfsd_unlink(rqstp, &cstate->current_fh, 0,
                             remove->rm_name, remove->rm_namelen);
@@ -848,7 +846,7 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 
        if (!cstate->save_fh.fh_dentry)
                return status;
-       if (locks_in_grace(SVC_NET(rqstp)) &&
+       if (opens_in_grace(SVC_NET(rqstp)) &&
                !(cstate->save_fh.fh_export->ex_flags & NFSEXP_NOSUBTREECHECK))
                return nfserr_grace;
        status = nfsd_rename(rqstp, &cstate->save_fh, rename->rn_sname,
@@ -1364,10 +1362,6 @@ nfsd4_layoutcommit(struct svc_rqst *rqstp,
                goto out;
        }
 
-       nfserr = ops->proc_layoutcommit(inode, lcp);
-       if (nfserr)
-               goto out_put_stid;
-
        if (new_size > i_size_read(inode)) {
                lcp->lc_size_chg = 1;
                lcp->lc_newsize = new_size;
@@ -1375,7 +1369,7 @@ nfsd4_layoutcommit(struct svc_rqst *rqstp,
                lcp->lc_size_chg = 0;
        }
 
-out_put_stid:
+       nfserr = ops->proc_layoutcommit(inode, lcp);
        nfs4_put_stid(&ls->ls_stid);
 out:
        return nfserr;