Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

NFS: Extend rdirplus mount option with "force|none"

There are certain users that wish to force the NFS client to choose
READDIRPLUS over READDIR for a particular mount. Update the "rdirplus" mount
option to optionally accept values. For "rdirplus=force", the NFS client
will always attempt to use READDDIRPLUS. The setting of "rdirplus=none" is
aliased to the existing "nordirplus".

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Link: https://lore.kernel.org/r/c4cf0de4c8be0930b91bc74bee310d289781cd3b.1741885071.git.bcodding@redhat.com
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

authored by

Benjamin Coddington and committed by
Trond Myklebust
cfe1f877 2d6a194f

+32 -4
+2
fs/nfs/dir.c
··· 666 666 { 667 667 if (!nfs_server_capable(dir, NFS_CAP_READDIRPLUS)) 668 668 return false; 669 + if (NFS_SERVER(dir)->flags & NFS_MOUNT_FORCE_RDIRPLUS) 670 + return true; 669 671 if (ctx->pos == 0 || 670 672 cache_hits + cache_misses > NFS_READDIR_CACHE_USAGE_THRESHOLD) 671 673 return true;
+28 -4
fs/nfs/fs_context.c
··· 72 72 Opt_posix, 73 73 Opt_proto, 74 74 Opt_rdirplus, 75 + Opt_rdirplus_none, 76 + Opt_rdirplus_force, 75 77 Opt_rdma, 76 78 Opt_resvport, 77 79 Opt_retrans, ··· 176 174 fsparam_u32 ("port", Opt_port), 177 175 fsparam_flag_no("posix", Opt_posix), 178 176 fsparam_string("proto", Opt_proto), 179 - fsparam_flag_no("rdirplus", Opt_rdirplus), 177 + fsparam_flag_no("rdirplus", Opt_rdirplus), // rdirplus|nordirplus 178 + fsparam_string("rdirplus", Opt_rdirplus), // rdirplus=... 180 179 fsparam_flag ("rdma", Opt_rdma), 181 180 fsparam_flag_no("resvport", Opt_resvport), 182 181 fsparam_u32 ("retrans", Opt_retrans), ··· 288 285 { "none", Opt_xprtsec_none }, 289 286 { "tls", Opt_xprtsec_tls }, 290 287 { "mtls", Opt_xprtsec_mtls }, 288 + {} 289 + }; 290 + 291 + static const struct constant_table nfs_rdirplus_tokens[] = { 292 + { "none", Opt_rdirplus_none }, 293 + { "force", Opt_rdirplus_force }, 291 294 {} 292 295 }; 293 296 ··· 645 636 ctx->flags &= ~NFS_MOUNT_NOACL; 646 637 break; 647 638 case Opt_rdirplus: 648 - if (result.negated) 639 + if (result.negated) { 640 + ctx->flags &= ~NFS_MOUNT_FORCE_RDIRPLUS; 649 641 ctx->flags |= NFS_MOUNT_NORDIRPLUS; 650 - else 651 - ctx->flags &= ~NFS_MOUNT_NORDIRPLUS; 642 + } else if (!param->string) { 643 + ctx->flags &= ~(NFS_MOUNT_NORDIRPLUS | NFS_MOUNT_FORCE_RDIRPLUS); 644 + } else { 645 + switch (lookup_constant(nfs_rdirplus_tokens, param->string, -1)) { 646 + case Opt_rdirplus_none: 647 + ctx->flags &= ~NFS_MOUNT_FORCE_RDIRPLUS; 648 + ctx->flags |= NFS_MOUNT_NORDIRPLUS; 649 + break; 650 + case Opt_rdirplus_force: 651 + ctx->flags &= ~NFS_MOUNT_NORDIRPLUS; 652 + ctx->flags |= NFS_MOUNT_FORCE_RDIRPLUS; 653 + break; 654 + default: 655 + goto out_invalid_value; 656 + } 657 + } 652 658 break; 653 659 case Opt_sharecache: 654 660 if (result.negated)
+1
fs/nfs/super.c
··· 454 454 { NFS_MOUNT_NONLM, ",nolock", "" }, 455 455 { NFS_MOUNT_NOACL, ",noacl", "" }, 456 456 { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" }, 457 + { NFS_MOUNT_FORCE_RDIRPLUS, ",rdirplus=force", "" }, 457 458 { NFS_MOUNT_UNSHARED, ",nosharecache", "" }, 458 459 { NFS_MOUNT_NORESVPORT, ",noresvport", "" }, 459 460 { 0, NULL, NULL }
+1
include/linux/nfs_fs_sb.h
··· 167 167 #define NFS_MOUNT_TRUNK_DISCOVERY 0x04000000 168 168 #define NFS_MOUNT_SHUTDOWN 0x08000000 169 169 #define NFS_MOUNT_NO_ALIGNWRITE 0x10000000 170 + #define NFS_MOUNT_FORCE_RDIRPLUS 0x20000000 170 171 171 172 unsigned int fattr_valid; /* Valid attributes */ 172 173 unsigned int caps; /* server capabilities */