Patch "nfsd: fix race to check ls_layouts" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nfsd: fix race to check ls_layouts

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nfsd-fix-race-to-check-ls_layouts.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fd226aee31d4fba24da4d1f70973bbd74b205f0a
Author: Benjamin Coddington <bcodding@xxxxxxxxxx>
Date:   Fri Jan 27 11:18:56 2023 -0500

    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@xxxxxxxxxx>
    Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>
    Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index f4cf1c0793c6a..cf81b5bc3e156 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);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux