Skip to content

Commit fb610c4

Browse files
bcodding-rhchucklever
authored andcommitted
nfsd: fix race to check ls_layouts
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: c5c707f ("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>
1 parent 826b67e commit fb610c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/nfsd/nfs4layouts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,11 @@ nfsd4_recall_file_layout(struct nfs4_layout_stateid *ls)
323323
if (ls->ls_recalled)
324324
goto out_unlock;
325325

326-
ls->ls_recalled = true;
327-
atomic_inc(&ls->ls_stid.sc_file->fi_lo_recalls);
328326
if (list_empty(&ls->ls_layouts))
329327
goto out_unlock;
330328

329+
ls->ls_recalled = true;
330+
atomic_inc(&ls->ls_stid.sc_file->fi_lo_recalls);
331331
trace_nfsd_layout_recall(&ls->ls_stid.sc_stateid);
332332

333333
refcount_inc(&ls->ls_stid.sc_count);

0 commit comments

Comments
 (0)