Re: [PATCH] nfsd: fix race to check ls_layouts
From: Chuck Lever III <hidden>
Date: 2023-01-27 16:34:35
On Jan 27, 2023, at 11:18 AM, Benjamin Coddington [off-list ref] wrote: 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. Signed-off-by: Benjamin Coddington <redacted>
Did this start misbehaving recently, or has it always been broken?
That is, does it need:
Fixes: c5c707f96fc9 ("nfsd: implement pNFS layout recalls") ?
quoted hunk ↗ jump to hunk
--- fs/nfsd/nfs4layouts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c index 3564d1c6f610..e8a80052cb1b 100644 --- a/fs/nfsd/nfs4layouts.c +++ b/fs/nfsd/nfs4layouts.c@@ -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); -- 2.31.1
-- Chuck Lever