Skip to content

Commit 44f411c

Browse files
olgakorn1Trond Myklebust
authored andcommitted
NFSv4.x: fix lock recovery during delegation recall
Running "./nfstest_delegation --runtest recall26" uncovers that client doesn't recover the lock when we have an appending open, where the initial open got a write delegation. Instead of checking for the passed in open context against the file lock's open context. Check that the state is the same. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 2192476 commit 44f411c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/nfs/delegation.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int nfs4_check_delegation(struct inode *inode, fmode_t flags)
9393
return nfs4_do_check_delegation(inode, flags, false);
9494
}
9595

96-
static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid)
96+
static int nfs_delegation_claim_locks(struct nfs4_state *state, const nfs4_stateid *stateid)
9797
{
9898
struct inode *inode = state->inode;
9999
struct file_lock *fl;
@@ -108,7 +108,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_
108108
spin_lock(&flctx->flc_lock);
109109
restart:
110110
list_for_each_entry(fl, list, fl_list) {
111-
if (nfs_file_open_context(fl->fl_file) != ctx)
111+
if (nfs_file_open_context(fl->fl_file)->state != state)
112112
continue;
113113
spin_unlock(&flctx->flc_lock);
114114
status = nfs4_lock_delegation_recall(fl, state, stateid);
@@ -156,7 +156,7 @@ static int nfs_delegation_claim_opens(struct inode *inode,
156156
seq = raw_seqcount_begin(&sp->so_reclaim_seqcount);
157157
err = nfs4_open_delegation_recall(ctx, state, stateid, type);
158158
if (!err)
159-
err = nfs_delegation_claim_locks(ctx, state, stateid);
159+
err = nfs_delegation_claim_locks(state, stateid);
160160
if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq))
161161
err = -EAGAIN;
162162
mutex_unlock(&sp->so_delegreturn_mutex);

0 commit comments

Comments
 (0)