Patch "nfsd: fix nfsd4_deleg_getattr_conflict in presence of third party lease" has been added to the 6.10-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 nfsd4_deleg_getattr_conflict in presence of third party lease

to the 6.10-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-nfsd4_deleg_getattr_conflict-in-presence-of.patch
and it can be found in the queue-6.10 subdirectory.

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



commit c732ca9198e217d54084b5305f40d5674dfab5cc
Author: NeilBrown <neilb@xxxxxxx>
Date:   Thu Aug 29 09:06:28 2024 +1000

    nfsd: fix nfsd4_deleg_getattr_conflict in presence of third party lease
    
    [ Upstream commit 40927f3d0972bf86357a32a5749be71a551241b6 ]
    
    It is not safe to dereference fl->c.flc_owner without first confirming
    fl->fl_lmops is the expected manager.  nfsd4_deleg_getattr_conflict()
    tests fl_lmops but largely ignores the result and assumes that flc_owner
    is an nfs4_delegation anyway.  This is wrong.
    
    With this patch we restore the "!= &nfsd_lease_mng_ops" case to behave
    as it did before the change mentioned below.  This is the same as the
    current code, but without any reference to a possible delegation.
    
    Fixes: c5967721e106 ("NFSD: handle GETATTR conflict with write delegation")
    Signed-off-by: NeilBrown <neilb@xxxxxxx>
    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/nfs4state.c b/fs/nfsd/nfs4state.c
index 07f2496850c4c..a366fb1c1b9b4 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -8859,7 +8859,15 @@ nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct dentry *dentry,
 			 */
 			if (type == F_RDLCK)
 				break;
-			goto break_lease;
+
+			nfsd_stats_wdeleg_getattr_inc(nn);
+			spin_unlock(&ctx->flc_lock);
+
+			status = nfserrno(nfsd_open_break_lease(inode, NFSD_MAY_READ));
+			if (status != nfserr_jukebox ||
+			    !nfsd_wait_for_delegreturn(rqstp, inode))
+				return status;
+			return 0;
 		}
 		if (type == F_WRLCK) {
 			struct nfs4_delegation *dp = fl->c.flc_owner;
@@ -8868,7 +8876,6 @@ nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct dentry *dentry,
 				spin_unlock(&ctx->flc_lock);
 				return 0;
 			}
-break_lease:
 			nfsd_stats_wdeleg_getattr_inc(nn);
 			dp = fl->c.flc_owner;
 			refcount_inc(&dp->dl_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