mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 18:55:12 +00:00
nfsd: fix race to check ls_layouts
[ Upstream commitfb610c4dbc
] Its possible for __break_lease to find the layout's lease before we've added the layout to the owner's ls_layouts list. In that case, setting ls_recalled = true without actually recalling the layout will cause the server to never send a recall callback. Move the check for ls_layouts before setting ls_recalled. Fixes:c5c707f96f
("nfsd: implement pNFS layout recalls") Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9f0df37520
commit
17f2a1a3cd
@ -323,11 +323,11 @@ nfsd4_recall_file_layout(struct nfs4_layout_stateid *ls)
|
||||
if (ls->ls_recalled)
|
||||
goto out_unlock;
|
||||
|
||||
ls->ls_recalled = true;
|
||||
atomic_inc(&ls->ls_stid.sc_file->fi_lo_recalls);
|
||||
if (list_empty(&ls->ls_layouts))
|
||||
goto out_unlock;
|
||||
|
||||
ls->ls_recalled = true;
|
||||
atomic_inc(&ls->ls_stid.sc_file->fi_lo_recalls);
|
||||
trace_nfsd_layout_recall(&ls->ls_stid.sc_stateid);
|
||||
|
||||
refcount_inc(&ls->ls_stid.sc_count);
|
||||
|
Loading…
Reference in New Issue
Block a user