Skip to content

Commit

Permalink
NFSv4.x: Don't return NFS4ERR_NOMATCHING_LAYOUT if we're unmounting
Browse files Browse the repository at this point in the history
[ Upstream commit 8926cc8 ]

If the NFS super block is being unmounted, then we currently may end up
telling the server that we've forgotten the layout while it is actually
still in use by the client.
In that case, just assume that the client will soon return the layout
anyway, and so return NFS4ERR_DELAY in response to the layout recall.

Fixes: 58ac3e5 ("NFSv4/pnfs: Clean up nfs_layout_find_inode()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Trond Myklebust authored and gregkh committed May 19, 2021
1 parent 5d254e1 commit b4bf335
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions fs/nfs/callback_proc.c
Expand Up @@ -132,12 +132,12 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp,
list_for_each_entry_rcu(lo, &server->layouts, plh_layouts) {
if (!pnfs_layout_is_valid(lo))
continue;
if (stateid != NULL &&
!nfs4_stateid_match_other(stateid, &lo->plh_stateid))
if (!nfs4_stateid_match_other(stateid, &lo->plh_stateid))
continue;
if (!nfs_sb_active(server->super))
continue;
inode = igrab(lo->plh_inode);
if (nfs_sb_active(server->super))
inode = igrab(lo->plh_inode);
else
inode = ERR_PTR(-EAGAIN);
rcu_read_unlock();
if (inode)
return inode;
Expand Down Expand Up @@ -171,9 +171,10 @@ static struct inode *nfs_layout_find_inode_by_fh(struct nfs_client *clp,
continue;
if (nfsi->layout != lo)
continue;
if (!nfs_sb_active(server->super))
continue;
inode = igrab(lo->plh_inode);
if (nfs_sb_active(server->super))
inode = igrab(lo->plh_inode);
else
inode = ERR_PTR(-EAGAIN);
rcu_read_unlock();
if (inode)
return inode;
Expand Down

0 comments on commit b4bf335

Please sign in to comment.