aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2014-06-30 11:48:36 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-07-08 17:14:35 -0400
commitdb24b3b4b2a510ad0face05aec1c5bfbe89050bb (patch)
treeb630d15752fbce01a1c0a4422161f2ee2ca42e35 /fs/nfsd/nfs4state.c
parentb607664ee74313c7f3f657a044eda572051e560e (diff)
nfsd: declare v4.1+ openowners confirmed on creation
There's no need to confirm an openowner in v4.1 and above, so we can go ahead and set NFS4_OO_CONFIRMED when we create openowners in those versions. This will also be necessary when we remove the client_mutex, as it'll be possible for two concurrent opens to race in versions >4.0. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 993da47cbc06..106db71e0eef 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2719,7 +2719,10 @@ static void hash_openowner(struct nfs4_openowner *oo, struct nfs4_client *clp, u
2719} 2719}
2720 2720
2721static struct nfs4_openowner * 2721static struct nfs4_openowner *
2722alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp, struct nfsd4_open *open) { 2722alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp,
2723 struct nfsd4_open *open,
2724 struct nfsd4_compound_state *cstate)
2725{
2723 struct nfs4_openowner *oo; 2726 struct nfs4_openowner *oo;
2724 2727
2725 oo = alloc_stateowner(openowner_slab, &open->op_owner, clp); 2728 oo = alloc_stateowner(openowner_slab, &open->op_owner, clp);
@@ -2728,6 +2731,8 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp, str
2728 oo->oo_owner.so_is_open_owner = 1; 2731 oo->oo_owner.so_is_open_owner = 1;
2729 oo->oo_owner.so_seqid = open->op_seqid; 2732 oo->oo_owner.so_seqid = open->op_seqid;
2730 oo->oo_flags = NFS4_OO_NEW; 2733 oo->oo_flags = NFS4_OO_NEW;
2734 if (nfsd4_has_session(cstate))
2735 oo->oo_flags |= NFS4_OO_CONFIRMED;
2731 oo->oo_time = 0; 2736 oo->oo_time = 0;
2732 oo->oo_last_closed_stid = NULL; 2737 oo->oo_last_closed_stid = NULL;
2733 INIT_LIST_HEAD(&oo->oo_close_lru); 2738 INIT_LIST_HEAD(&oo->oo_close_lru);
@@ -2987,7 +2992,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
2987 clp = oo->oo_owner.so_client; 2992 clp = oo->oo_owner.so_client;
2988 goto alloc_stateid; 2993 goto alloc_stateid;
2989new_owner: 2994new_owner:
2990 oo = alloc_init_open_stateowner(strhashval, clp, open); 2995 oo = alloc_init_open_stateowner(strhashval, clp, open, cstate);
2991 if (oo == NULL) 2996 if (oo == NULL)
2992 return nfserr_jukebox; 2997 return nfserr_jukebox;
2993 open->op_openowner = oo; 2998 open->op_openowner = oo;
@@ -3397,8 +3402,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
3397 memcpy(&open->op_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); 3402 memcpy(&open->op_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
3398 3403
3399 if (nfsd4_has_session(&resp->cstate)) { 3404 if (nfsd4_has_session(&resp->cstate)) {
3400 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
3401
3402 if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) { 3405 if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) {
3403 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; 3406 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
3404 open->op_why_no_deleg = WND4_NOT_WANTED; 3407 open->op_why_no_deleg = WND4_NOT_WANTED;
@@ -3792,8 +3795,9 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,
3792 3795
3793 nfs4_lock_state(); 3796 nfs4_lock_state();
3794 3797
3795 status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, 3798 status = nfsd4_lookup_stateid(stateid,
3796 &s, cstate->minorversion, nn); 3799 NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID,
3800 &s, cstate->minorversion, nn);
3797 if (status) 3801 if (status)
3798 goto out; 3802 goto out;
3799 status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate)); 3803 status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate));