Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db24b3b4 authored by Jeff Layton's avatar Jeff Layton Committed by J. Bruce Fields
Browse files

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: default avatarJeff Layton <jlayton@primarydata.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent b607664e
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -2719,7 +2719,10 @@ static void hash_openowner(struct nfs4_openowner *oo, struct nfs4_client *clp, u
}
}


static struct nfs4_openowner *
static struct nfs4_openowner *
alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp, struct nfsd4_open *open) {
alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp,
			   struct nfsd4_open *open,
			   struct nfsd4_compound_state *cstate)
{
	struct nfs4_openowner *oo;
	struct nfs4_openowner *oo;


	oo = alloc_stateowner(openowner_slab, &open->op_owner, clp);
	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
	oo->oo_owner.so_is_open_owner = 1;
	oo->oo_owner.so_is_open_owner = 1;
	oo->oo_owner.so_seqid = open->op_seqid;
	oo->oo_owner.so_seqid = open->op_seqid;
	oo->oo_flags = NFS4_OO_NEW;
	oo->oo_flags = NFS4_OO_NEW;
	if (nfsd4_has_session(cstate))
		oo->oo_flags |= NFS4_OO_CONFIRMED;
	oo->oo_time = 0;
	oo->oo_time = 0;
	oo->oo_last_closed_stid = NULL;
	oo->oo_last_closed_stid = NULL;
	INIT_LIST_HEAD(&oo->oo_close_lru);
	INIT_LIST_HEAD(&oo->oo_close_lru);
@@ -2987,7 +2992,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
	clp = oo->oo_owner.so_client;
	clp = oo->oo_owner.so_client;
	goto alloc_stateid;
	goto alloc_stateid;
new_owner:
new_owner:
	oo = alloc_init_open_stateowner(strhashval, clp, open);
	oo = alloc_init_open_stateowner(strhashval, clp, open, cstate);
	if (oo == NULL)
	if (oo == NULL)
		return nfserr_jukebox;
		return nfserr_jukebox;
	open->op_openowner = oo;
	open->op_openowner = oo;
@@ -3397,8 +3402,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
	memcpy(&open->op_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
	memcpy(&open->op_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));


	if (nfsd4_has_session(&resp->cstate)) {
	if (nfsd4_has_session(&resp->cstate)) {
		open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;

		if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) {
		if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) {
			open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
			open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
			open->op_why_no_deleg = WND4_NOT_WANTED;
			open->op_why_no_deleg = WND4_NOT_WANTED;
@@ -3792,7 +3795,8 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,


	nfs4_lock_state();
	nfs4_lock_state();


	status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID,
	status = nfsd4_lookup_stateid(stateid,
				NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID,
				&s, cstate->minorversion, nn);
				&s, cstate->minorversion, nn);
	if (status)
	if (status)
		goto out;
		goto out;