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

Commit 5e99b532 authored by Jeff Layton's avatar Jeff Layton Committed by Trond Myklebust
Browse files

nfs4: reset states to use open_stateid when returning delegation voluntarily



When the client goes to return a delegation, it should always update any
nfs4_state currently set up to use that delegation stateid to instead
use the open stateid. It already does do this in some cases,
particularly in the state recovery code, but not currently when the
delegation is voluntarily returned (e.g. in advance of a RENAME).  This
causes the client to try to continue using the delegation stateid after
the DELEGRETURN, e.g. in LAYOUTGET.

Set the nfs4_state back to using the open stateid in
nfs4_open_delegation_recall, just before clearing the
NFS_DELEGATED_STATE bit.

Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent e92c1e0d
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1777,6 +1777,9 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx,
	if (IS_ERR(opendata))
	if (IS_ERR(opendata))
		return PTR_ERR(opendata);
		return PTR_ERR(opendata);
	nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid);
	nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid);
	write_seqlock(&state->seqlock);
	nfs4_stateid_copy(&state->stateid, &state->open_stateid);
	write_sequnlock(&state->seqlock);
	clear_bit(NFS_DELEGATED_STATE, &state->flags);
	clear_bit(NFS_DELEGATED_STATE, &state->flags);
	switch (type & (FMODE_READ|FMODE_WRITE)) {
	switch (type & (FMODE_READ|FMODE_WRITE)) {
	case FMODE_READ|FMODE_WRITE:
	case FMODE_READ|FMODE_WRITE: