提交 d50ef120 编写于 作者: O Olga Kornievskaia 提交者: Joseph Qi

NFSv4.x: fix lock recovery during delegation recall

commit 44f411c353bf6d98d5a34f8f1b8605d43b2e50b8 upstream.

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: NOlga Kornievskaia <kolga@netapp.com>
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NCaspar Zhang <caspar@linux.alibaba.com>
上级 e5151915
...@@ -93,7 +93,7 @@ int nfs4_check_delegation(struct inode *inode, fmode_t flags) ...@@ -93,7 +93,7 @@ int nfs4_check_delegation(struct inode *inode, fmode_t flags)
return nfs4_do_check_delegation(inode, flags, false); return nfs4_do_check_delegation(inode, flags, false);
} }
static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid) static int nfs_delegation_claim_locks(struct nfs4_state *state, const nfs4_stateid *stateid)
{ {
struct inode *inode = state->inode; struct inode *inode = state->inode;
struct file_lock *fl; struct file_lock *fl;
...@@ -108,7 +108,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_ ...@@ -108,7 +108,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_
spin_lock(&flctx->flc_lock); spin_lock(&flctx->flc_lock);
restart: restart:
list_for_each_entry(fl, list, fl_list) { list_for_each_entry(fl, list, fl_list) {
if (nfs_file_open_context(fl->fl_file) != ctx) if (nfs_file_open_context(fl->fl_file)->state != state)
continue; continue;
spin_unlock(&flctx->flc_lock); spin_unlock(&flctx->flc_lock);
status = nfs4_lock_delegation_recall(fl, state, stateid); status = nfs4_lock_delegation_recall(fl, state, stateid);
...@@ -155,7 +155,7 @@ static int nfs_delegation_claim_opens(struct inode *inode, ...@@ -155,7 +155,7 @@ static int nfs_delegation_claim_opens(struct inode *inode,
seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); seq = raw_seqcount_begin(&sp->so_reclaim_seqcount);
err = nfs4_open_delegation_recall(ctx, state, stateid, type); err = nfs4_open_delegation_recall(ctx, state, stateid, type);
if (!err) if (!err)
err = nfs_delegation_claim_locks(ctx, state, stateid); err = nfs_delegation_claim_locks(state, stateid);
if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq))
err = -EAGAIN; err = -EAGAIN;
mutex_unlock(&sp->so_delegreturn_mutex); mutex_unlock(&sp->so_delegreturn_mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册