Patch "NFS: avoid infinite loop in pnfs_update_layout." has been added to the 6.1-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

    NFS: avoid infinite loop in pnfs_update_layout.

to the 6.1-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:
     nfs-avoid-infinite-loop-in-pnfs_update_layout.patch
and it can be found in the queue-6.1 subdirectory.

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



commit eef7b3ae9736e8b0f6ce7d93a80eae340856dd5a
Author: NeilBrown <neilb@xxxxxxx>
Date:   Wed Feb 28 11:24:53 2024 +1100

    NFS: avoid infinite loop in pnfs_update_layout.
    
    [ Upstream commit 2fdbc20036acda9e5694db74a032d3c605323005 ]
    
    If pnfsd_update_layout() is called on a file for which recovery has
    failed it will enter a tight infinite loop.
    
    NFS_LAYOUT_INVALID_STID will be set, nfs4_select_rw_stateid() will
    return -EIO, and nfs4_schedule_stateid_recovery() will do nothing, so
    nfs4_client_recover_expired_lease() will not wait.  So the code will
    loop indefinitely.
    
    Break the loop by testing the validity of the open stateid at the top of
    the loop.
    
    Signed-off-by: NeilBrown <neilb@xxxxxxx>
    Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 4448ff829cbb9..8c1f47ca5dc53 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1997,6 +1997,14 @@ pnfs_update_layout(struct inode *ino,
 	}
 
 lookup_again:
+	if (!nfs4_valid_open_stateid(ctx->state)) {
+		trace_pnfs_update_layout(ino, pos, count,
+					 iomode, lo, lseg,
+					 PNFS_UPDATE_LAYOUT_INVALID_OPEN);
+		lseg = ERR_PTR(-EIO);
+		goto out;
+	}
+
 	lseg = ERR_PTR(nfs4_client_recover_expired_lease(clp));
 	if (IS_ERR(lseg))
 		goto out;




[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