Commit bdc59cf2 authored by Trond Myklebust's avatar Trond Myklebust

pNFS: pnfs_roc_drain() fix a race with open

If a process reopens the file before we can send off the CLOSE/DELEGRETURN,
then pnfs_roc_drain() may end up waiting for a new set of layout segments
that are marked as return-on-close, but haven't yet been returned.

Fix this by only waiting for those layout segments that were invalidated in
pnfs_roc().
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 7f27392c
...@@ -1159,12 +1159,15 @@ bool pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task) ...@@ -1159,12 +1159,15 @@ bool pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task)
bool layoutreturn = false; bool layoutreturn = false;
spin_lock(&ino->i_lock); spin_lock(&ino->i_lock);
list_for_each_entry(lseg, &nfsi->layout->plh_segs, pls_list) list_for_each_entry(lseg, &nfsi->layout->plh_segs, pls_list) {
if (test_bit(NFS_LSEG_ROC, &lseg->pls_flags)) { if (!test_bit(NFS_LSEG_ROC, &lseg->pls_flags))
rpc_sleep_on(&NFS_SERVER(ino)->roc_rpcwaitq, task, NULL); continue;
spin_unlock(&ino->i_lock); if (test_bit(NFS_LSEG_VALID, &lseg->pls_flags))
return true; continue;
} rpc_sleep_on(&NFS_SERVER(ino)->roc_rpcwaitq, task, NULL);
spin_unlock(&ino->i_lock);
return true;
}
lo = nfsi->layout; lo = nfsi->layout;
current_seqid = be32_to_cpu(lo->plh_stateid.seqid); current_seqid = be32_to_cpu(lo->plh_stateid.seqid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment