]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0013-NFSv4.1-provide-mount-option-to-toggle-trunking-disc.patch
91712a5069a522e25539601fa783dc01ebf04632
[pve-kernel.git] / patches / kernel / 0013-NFSv4.1-provide-mount-option-to-toggle-trunking-disc.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Olga Kornievskaia <kolga@netapp.com>
3 Date: Wed, 16 Mar 2022 18:24:26 -0400
4 Subject: [PATCH] NFSv4.1 provide mount option to toggle trunking discovery
5
6 Introduce a new mount option -- trunkdiscovery,notrunkdiscovery -- to
7 toggle whether or not the client will engage in actively discovery
8 of trunking locations.
9
10 v2 make notrunkdiscovery default
11
12 Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
13 Fixes: 1976b2b31462 ("NFSv4.1 query for fs_location attr on a new file system")
14 Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
15 (cherry picked from commit a43bf604446414103b7535f38e739b65601c4fb2)
16 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 ---
18 fs/nfs/client.c | 3 ++-
19 fs/nfs/fs_context.c | 8 ++++++++
20 include/linux/nfs_fs_sb.h | 1 +
21 3 files changed, 11 insertions(+), 1 deletion(-)
22
23 diff --git a/fs/nfs/client.c b/fs/nfs/client.c
24 index 090b16890e3d..f303e96ce165 100644
25 --- a/fs/nfs/client.c
26 +++ b/fs/nfs/client.c
27 @@ -861,7 +861,8 @@ int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs
28 }
29
30 if (clp->rpc_ops->discover_trunking != NULL &&
31 - (server->caps & NFS_CAP_FS_LOCATIONS)) {
32 + (server->caps & NFS_CAP_FS_LOCATIONS &&
33 + (server->flags & NFS_MOUNT_TRUNK_DISCOVERY))) {
34 error = clp->rpc_ops->discover_trunking(server, mntfh);
35 if (error < 0)
36 return error;
37 diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
38 index 0d444a90f513..da5217abc2e5 100644
39 --- a/fs/nfs/fs_context.c
40 +++ b/fs/nfs/fs_context.c
41 @@ -79,6 +79,7 @@ enum nfs_param {
42 Opt_source,
43 Opt_tcp,
44 Opt_timeo,
45 + Opt_trunkdiscovery,
46 Opt_udp,
47 Opt_v,
48 Opt_vers,
49 @@ -179,6 +180,7 @@ static const struct fs_parameter_spec nfs_fs_parameters[] = {
50 fsparam_string("source", Opt_source),
51 fsparam_flag ("tcp", Opt_tcp),
52 fsparam_u32 ("timeo", Opt_timeo),
53 + fsparam_flag_no("trunkdiscovery", Opt_trunkdiscovery),
54 fsparam_flag ("udp", Opt_udp),
55 fsparam_flag ("v2", Opt_v),
56 fsparam_flag ("v3", Opt_v),
57 @@ -528,6 +530,12 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
58 else
59 ctx->flags &= ~NFS_MOUNT_NOCTO;
60 break;
61 + case Opt_trunkdiscovery:
62 + if (result.negated)
63 + ctx->flags &= ~NFS_MOUNT_TRUNK_DISCOVERY;
64 + else
65 + ctx->flags |= NFS_MOUNT_TRUNK_DISCOVERY;
66 + break;
67 case Opt_ac:
68 if (result.negated)
69 ctx->flags |= NFS_MOUNT_NOAC;
70 diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
71 index 9a6e70ccde56..10c347416dd2 100644
72 --- a/include/linux/nfs_fs_sb.h
73 +++ b/include/linux/nfs_fs_sb.h
74 @@ -156,6 +156,7 @@ struct nfs_server {
75 #define NFS_MOUNT_SOFTREVAL 0x800000
76 #define NFS_MOUNT_WRITE_EAGER 0x01000000
77 #define NFS_MOUNT_WRITE_WAIT 0x02000000
78 +#define NFS_MOUNT_TRUNK_DISCOVERY 0x04000000
79
80 unsigned int fattr_valid; /* Valid attributes */
81 unsigned int caps; /* server capabilities */