[PATCH] nfs: fix regression in handling of namlen= option in NFSv4

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

 



Setting the maximum length of a pathname component
via the namlen= mount option is currently broken in NFSv4.

This patch will fix this issue.

Signed-off-by: Chen Hanxiao <chenhx.fnst@xxxxxxxxxxx>
---
 fs/nfs/namespace.c     | 2 ++
 fs/nfs/nfs4client.c    | 2 ++
 fs/nfs/nfs4namespace.c | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index e7494cdd957e..8da1fc9ebbd4 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -277,6 +277,8 @@ int nfs_do_submount(struct fs_context *fc)
 	if (IS_ERR(server))
 		return PTR_ERR(server);
 
+	if (ctx->namlen)
+		server->namelen = ctx->namlen;
 	ctx->server = server;
 
 	buffer = kmalloc(4096, GFP_USER);
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index 11e3a285594c..9826c2fcb0a7 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -1187,6 +1187,8 @@ static int nfs4_init_server(struct nfs_server *server, struct fs_context *fc)
 		server->rsize = nfs_io_size(ctx->rsize, server->nfs_client->cl_proto);
 	if (ctx->wsize)
 		server->wsize = nfs_io_size(ctx->wsize, server->nfs_client->cl_proto);
+	if (ctx->namlen)
+		server->namelen = ctx->namlen;
 
 	server->acregmin = ctx->acregmin * HZ;
 	server->acregmax = ctx->acregmax * HZ;
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 9a98595bb160..1a30224df7b9 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -465,6 +465,8 @@ int nfs4_submount(struct fs_context *fc, struct nfs_server *server)
 		return PTR_ERR(client);
 
 	ctx->selected_flavor = client->cl_auth->au_flavor;
+	if (server->namelen)
+		ctx->namlen = server->namelen;
 	if (ctx->clone_data.fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) {
 		ret = nfs_do_refmount(fc, client);
 	} else {
-- 
2.39.1





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux