Patch "nfs: keep server info for remounts" has been added to the 6.9-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: keep server info for remounts

to the 6.9-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-keep-server-info-for-remounts.patch
and it can be found in the queue-6.9 subdirectory.

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



commit 4b2a4ed7490a9fe4a30fdda0b8a6849bd571ebde
Author: Martin Kaiser <martin@xxxxxxxxx>
Date:   Sun Apr 14 19:01:09 2024 +0200

    nfs: keep server info for remounts
    
    [ Upstream commit b322bf9e983addedff0894c55e92d58f4d16d92a ]
    
    With newer kernels that use fs_context for nfs mounts, remounts fail with
    -EINVAL.
    
    $ mount -t nfs -o nolock 10.0.0.1:/tmp/test /mnt/test/
    $ mount -t nfs -o remount /mnt/test/
    mount: mounting 10.0.0.1:/tmp/test on /mnt/test failed: Invalid argument
    
    For remounts, the nfs server address and port are populated by
    nfs_init_fs_context and later overwritten with 0x00 bytes by
    nfs23_parse_monolithic. The remount then fails as the server address is
    invalid.
    
    Fix this by not overwriting nfs server info in nfs23_parse_monolithic if
    we're doing a remount.
    
    Fixes: f2aedb713c28 ("NFS: Add fs_context support.")
    Signed-off-by: Martin Kaiser <martin@xxxxxxxxx>
    Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
index d0a0956f8a134..cac1157be2c29 100644
--- a/fs/nfs/fs_context.c
+++ b/fs/nfs/fs_context.c
@@ -1112,9 +1112,12 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
 		ctx->acdirmax	= data->acdirmax;
 		ctx->need_mount	= false;
 
-		memcpy(sap, &data->addr, sizeof(data->addr));
-		ctx->nfs_server.addrlen = sizeof(data->addr);
-		ctx->nfs_server.port = ntohs(data->addr.sin_port);
+		if (!is_remount_fc(fc)) {
+			memcpy(sap, &data->addr, sizeof(data->addr));
+			ctx->nfs_server.addrlen = sizeof(data->addr);
+			ctx->nfs_server.port = ntohs(data->addr.sin_port);
+		}
+
 		if (sap->ss_family != AF_INET ||
 		    !nfs_verify_server_address(sap))
 			goto out_no_address;




[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