diff options
| author | Benjamin Coddington <bcodding@redhat.com> | 2023-01-27 11:18:56 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-11 16:43:49 +0100 |
| commit | a22f1ecab6d413e74e81d5d0f9f2416a962e913c (patch) | |
| tree | 11f7a8ec6a5f51ae1170fd3d6d5505096df52f12 /fs | |
| parent | 5a195fa41d0147adfd7ae8cd78388f9d2bfc0334 (diff) | |
| download | linux-a22f1ecab6d413e74e81d5d0f9f2416a962e913c.tar.gz linux-a22f1ecab6d413e74e81d5d0f9f2416a962e913c.tar.bz2 linux-a22f1ecab6d413e74e81d5d0f9f2416a962e913c.zip | |
nfsd: fix race to check ls_layouts
[ Upstream commit fb610c4dbc996415d57d7090957ecddd4fd64fb6 ]
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: c5c707f96fc9 ("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>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/nfsd/nfs4layouts.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c index e12409eca7cc..215362144aec 100644 --- a/fs/nfsd/nfs4layouts.c +++ b/fs/nfsd/nfs4layouts.c @@ -322,11 +322,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); |
