1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 1992 Rick Sladkey
7 * nfs superblock handling functions
9 * Modularised by Alan Cox <alan@lxorguk.ukuu.org.uk>, while hacking some
10 * experimental NFS changes. Modularisation taken straight from SYS5 fs.
12 * Change to nfs_read_super() to permit NFS mounts to multi-homed hosts.
13 * J.S.Peatfield@damtp.cam.ac.uk
15 * Split from inode.c by David Howells <dhowells@redhat.com>
17 * - superblocks are indexed on server only - all inodes, dentries, etc. associated with a
18 * particular server are held in the same superblock
19 * - NFS superblocks can have several effective roots to the dentry tree
20 * - directory type roots are spliced into the tree when a path from one root reaches the root
21 * of another (see nfs_lookup())
24 #include <linux/module.h>
25 #include <linux/init.h>
27 #include <linux/time.h>
28 #include <linux/kernel.h>
30 #include <linux/string.h>
31 #include <linux/stat.h>
32 #include <linux/errno.h>
33 #include <linux/unistd.h>
34 #include <linux/sunrpc/clnt.h>
35 #include <linux/sunrpc/addr.h>
36 #include <linux/sunrpc/stats.h>
37 #include <linux/sunrpc/metrics.h>
38 #include <linux/sunrpc/xprtsock.h>
39 #include <linux/sunrpc/xprtrdma.h>
40 #include <linux/nfs_fs.h>
41 #include <linux/nfs_mount.h>
42 #include <linux/nfs4_mount.h>
43 #include <linux/lockd/bind.h>
44 #include <linux/seq_file.h>
45 #include <linux/mount.h>
46 #include <linux/namei.h>
47 #include <linux/vfs.h>
48 #include <linux/inet.h>
49 #include <linux/in6.h>
50 #include <linux/slab.h>
52 #include <linux/netdevice.h>
53 #include <linux/nfs_xdr.h>
54 #include <linux/magic.h>
55 #include <linux/parser.h>
56 #include <linux/nsproxy.h>
57 #include <linux/rcupdate.h>
59 #include <linux/uaccess.h>
63 #include "delegation.h"
67 #include "nfs4session.h"
71 #define NFSDBG_FACILITY NFSDBG_VFS
73 static struct dentry *nfs_prepared_mount(struct file_system_type *fs_type,
74 int flags, const char *dev_name, void *raw_data);
76 struct file_system_type nfs_fs_type = {
79 .mount = nfs_fs_mount,
80 .kill_sb = nfs_kill_super,
81 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA,
83 MODULE_ALIAS_FS("nfs");
84 EXPORT_SYMBOL_GPL(nfs_fs_type);
86 struct file_system_type nfs_prepared_fs_type = {
89 .mount = nfs_prepared_mount,
90 .kill_sb = nfs_kill_super,
91 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA,
93 EXPORT_SYMBOL_GPL(nfs_prepared_fs_type);
95 const struct super_operations nfs_sops = {
96 .alloc_inode = nfs_alloc_inode,
97 .free_inode = nfs_free_inode,
98 .write_inode = nfs_write_inode,
99 .drop_inode = nfs_drop_inode,
100 .statfs = nfs_statfs,
101 .evict_inode = nfs_evict_inode,
102 .umount_begin = nfs_umount_begin,
103 .show_options = nfs_show_options,
104 .show_devname = nfs_show_devname,
105 .show_path = nfs_show_path,
106 .show_stats = nfs_show_stats,
107 .remount_fs = nfs_remount,
109 EXPORT_SYMBOL_GPL(nfs_sops);
111 #if IS_ENABLED(CONFIG_NFS_V4)
112 struct file_system_type nfs4_fs_type = {
113 .owner = THIS_MODULE,
115 .mount = nfs_fs_mount,
116 .kill_sb = nfs_kill_super,
117 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA,
119 MODULE_ALIAS_FS("nfs4");
120 MODULE_ALIAS("nfs4");
121 EXPORT_SYMBOL_GPL(nfs4_fs_type);
123 static int __init register_nfs4_fs(void)
125 return register_filesystem(&nfs4_fs_type);
128 static void unregister_nfs4_fs(void)
130 unregister_filesystem(&nfs4_fs_type);
133 static int __init register_nfs4_fs(void)
138 static void unregister_nfs4_fs(void)
143 static struct shrinker acl_shrinker = {
144 .count_objects = nfs_access_cache_count,
145 .scan_objects = nfs_access_cache_scan,
146 .seeks = DEFAULT_SEEKS,
150 * Register the NFS filesystems
152 int __init register_nfs_fs(void)
156 ret = register_filesystem(&nfs_fs_type);
160 ret = register_nfs4_fs();
164 ret = nfs_register_sysctl();
167 ret = register_shrinker(&acl_shrinker);
172 nfs_unregister_sysctl();
174 unregister_nfs4_fs();
176 unregister_filesystem(&nfs_fs_type);
182 * Unregister the NFS filesystems
184 void __exit unregister_nfs_fs(void)
186 unregister_shrinker(&acl_shrinker);
187 nfs_unregister_sysctl();
188 unregister_nfs4_fs();
189 unregister_filesystem(&nfs_fs_type);
192 bool nfs_sb_active(struct super_block *sb)
194 struct nfs_server *server = NFS_SB(sb);
196 if (!atomic_inc_not_zero(&sb->s_active))
198 if (atomic_inc_return(&server->active) != 1)
199 atomic_dec(&sb->s_active);
202 EXPORT_SYMBOL_GPL(nfs_sb_active);
204 void nfs_sb_deactive(struct super_block *sb)
206 struct nfs_server *server = NFS_SB(sb);
208 if (atomic_dec_and_test(&server->active))
209 deactivate_super(sb);
211 EXPORT_SYMBOL_GPL(nfs_sb_deactive);
214 * Deliver file system statistics to userspace
216 int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
218 struct nfs_server *server = NFS_SB(dentry->d_sb);
219 unsigned char blockbits;
220 unsigned long blockres;
221 struct nfs_fh *fh = NFS_FH(d_inode(dentry));
222 struct nfs_fsstat res;
225 res.fattr = nfs_alloc_fattr();
226 if (res.fattr == NULL)
229 error = server->nfs_client->rpc_ops->statfs(server, fh, &res);
230 if (unlikely(error == -ESTALE)) {
231 struct dentry *pd_dentry;
233 pd_dentry = dget_parent(dentry);
234 nfs_zap_caches(d_inode(pd_dentry));
237 nfs_free_fattr(res.fattr);
241 buf->f_type = NFS_SUPER_MAGIC;
244 * Current versions of glibc do not correctly handle the
245 * case where f_frsize != f_bsize. Eventually we want to
246 * report the value of wtmult in this field.
248 buf->f_frsize = dentry->d_sb->s_blocksize;
251 * On most *nix systems, f_blocks, f_bfree, and f_bavail
252 * are reported in units of f_frsize. Linux hasn't had
253 * an f_frsize field in its statfs struct until recently,
254 * thus historically Linux's sys_statfs reports these
255 * fields in units of f_bsize.
257 buf->f_bsize = dentry->d_sb->s_blocksize;
258 blockbits = dentry->d_sb->s_blocksize_bits;
259 blockres = (1 << blockbits) - 1;
260 buf->f_blocks = (res.tbytes + blockres) >> blockbits;
261 buf->f_bfree = (res.fbytes + blockres) >> blockbits;
262 buf->f_bavail = (res.abytes + blockres) >> blockbits;
264 buf->f_files = res.tfiles;
265 buf->f_ffree = res.afiles;
267 buf->f_namelen = server->namelen;
272 dprintk("%s: statfs error = %d\n", __func__, -error);
275 EXPORT_SYMBOL_GPL(nfs_statfs);
278 * Map the security flavour number to a name
280 static const char *nfs_pseudoflavour_to_name(rpc_authflavor_t flavour)
282 static const struct {
283 rpc_authflavor_t flavour;
285 } sec_flavours[NFS_AUTH_INFO_MAX_FLAVORS] = {
286 /* update NFS_AUTH_INFO_MAX_FLAVORS when this list changes! */
287 { RPC_AUTH_NULL, "null" },
288 { RPC_AUTH_UNIX, "sys" },
289 { RPC_AUTH_GSS_KRB5, "krb5" },
290 { RPC_AUTH_GSS_KRB5I, "krb5i" },
291 { RPC_AUTH_GSS_KRB5P, "krb5p" },
292 { RPC_AUTH_GSS_LKEY, "lkey" },
293 { RPC_AUTH_GSS_LKEYI, "lkeyi" },
294 { RPC_AUTH_GSS_LKEYP, "lkeyp" },
295 { RPC_AUTH_GSS_SPKM, "spkm" },
296 { RPC_AUTH_GSS_SPKMI, "spkmi" },
297 { RPC_AUTH_GSS_SPKMP, "spkmp" },
298 { UINT_MAX, "unknown" }
302 for (i = 0; sec_flavours[i].flavour != UINT_MAX; i++) {
303 if (sec_flavours[i].flavour == flavour)
306 return sec_flavours[i].str;
309 static void nfs_show_mountd_netid(struct seq_file *m, struct nfs_server *nfss,
312 struct sockaddr *sap = (struct sockaddr *) &nfss->mountd_address;
315 switch (sap->sa_family) {
317 switch (nfss->mountd_protocol) {
319 proto = RPCBIND_NETID_UDP;
322 proto = RPCBIND_NETID_TCP;
327 switch (nfss->mountd_protocol) {
329 proto = RPCBIND_NETID_UDP6;
332 proto = RPCBIND_NETID_TCP6;
337 if (proto || showdefaults)
338 seq_printf(m, ",mountproto=%s", proto ?: "auto");
341 static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
344 struct sockaddr *sap = (struct sockaddr *)&nfss->mountd_address;
346 if (nfss->flags & NFS_MOUNT_LEGACY_INTERFACE)
349 switch (sap->sa_family) {
351 struct sockaddr_in *sin = (struct sockaddr_in *)sap;
352 seq_printf(m, ",mountaddr=%pI4", &sin->sin_addr.s_addr);
356 struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
357 seq_printf(m, ",mountaddr=%pI6c", &sin6->sin6_addr);
362 seq_puts(m, ",mountaddr=unspecified");
365 if (nfss->mountd_version || showdefaults)
366 seq_printf(m, ",mountvers=%u", nfss->mountd_version);
367 if ((nfss->mountd_port &&
368 nfss->mountd_port != (unsigned short)NFS_UNSPEC_PORT) ||
370 seq_printf(m, ",mountport=%u", nfss->mountd_port);
372 nfs_show_mountd_netid(m, nfss, showdefaults);
375 #if IS_ENABLED(CONFIG_NFS_V4)
376 static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
379 struct nfs_client *clp = nfss->nfs_client;
381 seq_printf(m, ",clientaddr=%s", clp->cl_ipaddr);
384 static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
390 static void nfs_show_nfs_version(struct seq_file *m,
391 unsigned int version,
392 unsigned int minorversion)
394 seq_printf(m, ",vers=%u", version);
396 seq_printf(m, ".%u", minorversion);
400 * Describe the mount options in force on this server representation
402 static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
405 static const struct proc_nfs_info {
410 { NFS_MOUNT_SOFT, ",soft", "" },
411 { NFS_MOUNT_SOFTERR, ",softerr", "" },
412 { NFS_MOUNT_POSIX, ",posix", "" },
413 { NFS_MOUNT_NOCTO, ",nocto", "" },
414 { NFS_MOUNT_NOAC, ",noac", "" },
415 { NFS_MOUNT_NONLM, ",nolock", "" },
416 { NFS_MOUNT_NOACL, ",noacl", "" },
417 { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" },
418 { NFS_MOUNT_UNSHARED, ",nosharecache", "" },
419 { NFS_MOUNT_NORESVPORT, ",noresvport", "" },
422 const struct proc_nfs_info *nfs_infop;
423 struct nfs_client *clp = nfss->nfs_client;
424 u32 version = clp->rpc_ops->version;
425 int local_flock, local_fcntl;
427 nfs_show_nfs_version(m, version, clp->cl_minorversion);
428 seq_printf(m, ",rsize=%u", nfss->rsize);
429 seq_printf(m, ",wsize=%u", nfss->wsize);
430 if (nfss->bsize != 0)
431 seq_printf(m, ",bsize=%u", nfss->bsize);
432 seq_printf(m, ",namlen=%u", nfss->namelen);
433 if (nfss->acregmin != NFS_DEF_ACREGMIN*HZ || showdefaults)
434 seq_printf(m, ",acregmin=%u", nfss->acregmin/HZ);
435 if (nfss->acregmax != NFS_DEF_ACREGMAX*HZ || showdefaults)
436 seq_printf(m, ",acregmax=%u", nfss->acregmax/HZ);
437 if (nfss->acdirmin != NFS_DEF_ACDIRMIN*HZ || showdefaults)
438 seq_printf(m, ",acdirmin=%u", nfss->acdirmin/HZ);
439 if (nfss->acdirmax != NFS_DEF_ACDIRMAX*HZ || showdefaults)
440 seq_printf(m, ",acdirmax=%u", nfss->acdirmax/HZ);
441 if (!(nfss->flags & (NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR)))
442 seq_puts(m, ",hard");
443 for (nfs_infop = nfs_info; nfs_infop->flag; nfs_infop++) {
444 if (nfss->flags & nfs_infop->flag)
445 seq_puts(m, nfs_infop->str);
447 seq_puts(m, nfs_infop->nostr);
450 seq_printf(m, ",proto=%s",
451 rpc_peeraddr2str(nfss->client, RPC_DISPLAY_NETID));
453 if (clp->cl_nconnect > 0)
454 seq_printf(m, ",nconnect=%u", clp->cl_nconnect);
456 if (nfss->port != NFS_PORT)
457 seq_printf(m, ",port=%u", nfss->port);
460 seq_printf(m, ",port=%u", nfss->port);
462 seq_printf(m, ",timeo=%lu", 10U * nfss->client->cl_timeout->to_initval / HZ);
463 seq_printf(m, ",retrans=%u", nfss->client->cl_timeout->to_retries);
464 seq_printf(m, ",sec=%s", nfs_pseudoflavour_to_name(nfss->client->cl_auth->au_flavor));
467 nfs_show_mountd_options(m, nfss, showdefaults);
469 nfs_show_nfsv4_options(m, nfss, showdefaults);
471 if (nfss->options & NFS_OPTION_FSCACHE)
474 if (nfss->options & NFS_OPTION_MIGRATION)
475 seq_puts(m, ",migration");
477 if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) {
478 if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
479 seq_puts(m, ",lookupcache=none");
481 seq_puts(m, ",lookupcache=pos");
484 local_flock = nfss->flags & NFS_MOUNT_LOCAL_FLOCK;
485 local_fcntl = nfss->flags & NFS_MOUNT_LOCAL_FCNTL;
487 if (!local_flock && !local_fcntl)
488 seq_puts(m, ",local_lock=none");
489 else if (local_flock && local_fcntl)
490 seq_puts(m, ",local_lock=all");
491 else if (local_flock)
492 seq_puts(m, ",local_lock=flock");
494 seq_puts(m, ",local_lock=posix");
498 * Describe the mount options on this VFS mountpoint
500 int nfs_show_options(struct seq_file *m, struct dentry *root)
502 struct nfs_server *nfss = NFS_SB(root->d_sb);
504 nfs_show_mount_options(m, nfss, 0);
507 seq_printf(m, ",addr=%s",
508 rpc_peeraddr2str(nfss->nfs_client->cl_rpcclient,
514 EXPORT_SYMBOL_GPL(nfs_show_options);
516 #if IS_ENABLED(CONFIG_NFS_V4)
517 static void show_lease(struct seq_file *m, struct nfs_server *server)
519 struct nfs_client *clp = server->nfs_client;
520 unsigned long expire;
522 seq_printf(m, ",lease_time=%ld", clp->cl_lease_time / HZ);
523 expire = clp->cl_last_renewal + clp->cl_lease_time;
524 seq_printf(m, ",lease_expired=%ld",
525 time_after(expire, jiffies) ? 0 : (jiffies - expire) / HZ);
527 #ifdef CONFIG_NFS_V4_1
528 static void show_sessions(struct seq_file *m, struct nfs_server *server)
530 if (nfs4_has_session(server->nfs_client))
531 seq_puts(m, ",sessions");
534 static void show_sessions(struct seq_file *m, struct nfs_server *server) {}
538 #ifdef CONFIG_NFS_V4_1
539 static void show_pnfs(struct seq_file *m, struct nfs_server *server)
541 seq_printf(m, ",pnfs=");
542 if (server->pnfs_curr_ld)
543 seq_printf(m, "%s", server->pnfs_curr_ld->name);
545 seq_printf(m, "not configured");
548 static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
550 if (nfss->nfs_client && nfss->nfs_client->cl_implid) {
551 struct nfs41_impl_id *impl_id = nfss->nfs_client->cl_implid;
552 seq_printf(m, "\n\timpl_id:\tname='%s',domain='%s',"
554 impl_id->name, impl_id->domain,
555 impl_id->date.seconds, impl_id->date.nseconds);
559 #if IS_ENABLED(CONFIG_NFS_V4)
560 static void show_pnfs(struct seq_file *m, struct nfs_server *server)
564 static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
569 int nfs_show_devname(struct seq_file *m, struct dentry *root)
571 char *page = (char *) __get_free_page(GFP_KERNEL);
572 char *devname, *dummy;
576 devname = nfs_path(&dummy, root, page, PAGE_SIZE, 0);
578 err = PTR_ERR(devname);
580 seq_escape(m, devname, " \t\n\\");
581 free_page((unsigned long)page);
584 EXPORT_SYMBOL_GPL(nfs_show_devname);
586 int nfs_show_path(struct seq_file *m, struct dentry *dentry)
591 EXPORT_SYMBOL_GPL(nfs_show_path);
594 * Present statistical information for this VFS mountpoint
596 int nfs_show_stats(struct seq_file *m, struct dentry *root)
599 struct nfs_server *nfss = NFS_SB(root->d_sb);
600 struct rpc_auth *auth = nfss->client->cl_auth;
601 struct nfs_iostats totals = { };
603 seq_printf(m, "statvers=%s", NFS_IOSTAT_VERS);
606 * Display all mount option settings
608 seq_puts(m, "\n\topts:\t");
609 seq_puts(m, sb_rdonly(root->d_sb) ? "ro" : "rw");
610 seq_puts(m, root->d_sb->s_flags & SB_SYNCHRONOUS ? ",sync" : "");
611 seq_puts(m, root->d_sb->s_flags & SB_NOATIME ? ",noatime" : "");
612 seq_puts(m, root->d_sb->s_flags & SB_NODIRATIME ? ",nodiratime" : "");
613 nfs_show_mount_options(m, nfss, 1);
615 seq_printf(m, "\n\tage:\t%lu", (jiffies - nfss->mount_time) / HZ);
617 show_implementation_id(m, nfss);
619 seq_puts(m, "\n\tcaps:\t");
620 seq_printf(m, "caps=0x%x", nfss->caps);
621 seq_printf(m, ",wtmult=%u", nfss->wtmult);
622 seq_printf(m, ",dtsize=%u", nfss->dtsize);
623 seq_printf(m, ",bsize=%u", nfss->bsize);
624 seq_printf(m, ",namlen=%u", nfss->namelen);
626 #if IS_ENABLED(CONFIG_NFS_V4)
627 if (nfss->nfs_client->rpc_ops->version == 4) {
628 seq_puts(m, "\n\tnfsv4:\t");
629 seq_printf(m, "bm0=0x%x", nfss->attr_bitmask[0]);
630 seq_printf(m, ",bm1=0x%x", nfss->attr_bitmask[1]);
631 seq_printf(m, ",bm2=0x%x", nfss->attr_bitmask[2]);
632 seq_printf(m, ",acl=0x%x", nfss->acl_bitmask);
633 show_sessions(m, nfss);
640 * Display security flavor in effect for this mount
642 seq_printf(m, "\n\tsec:\tflavor=%u", auth->au_ops->au_flavor);
644 seq_printf(m, ",pseudoflavor=%u", auth->au_flavor);
647 * Display superblock I/O counters
649 for_each_possible_cpu(cpu) {
650 struct nfs_iostats *stats;
653 stats = per_cpu_ptr(nfss->io_stats, cpu);
655 for (i = 0; i < __NFSIOS_COUNTSMAX; i++)
656 totals.events[i] += stats->events[i];
657 for (i = 0; i < __NFSIOS_BYTESMAX; i++)
658 totals.bytes[i] += stats->bytes[i];
659 #ifdef CONFIG_NFS_FSCACHE
660 for (i = 0; i < __NFSIOS_FSCACHEMAX; i++)
661 totals.fscache[i] += stats->fscache[i];
667 seq_puts(m, "\n\tevents:\t");
668 for (i = 0; i < __NFSIOS_COUNTSMAX; i++)
669 seq_printf(m, "%lu ", totals.events[i]);
670 seq_puts(m, "\n\tbytes:\t");
671 for (i = 0; i < __NFSIOS_BYTESMAX; i++)
672 seq_printf(m, "%Lu ", totals.bytes[i]);
673 #ifdef CONFIG_NFS_FSCACHE
674 if (nfss->options & NFS_OPTION_FSCACHE) {
675 seq_puts(m, "\n\tfsc:\t");
676 for (i = 0; i < __NFSIOS_FSCACHEMAX; i++)
677 seq_printf(m, "%Lu ", totals.fscache[i]);
682 rpc_clnt_show_stats(m, nfss->client);
686 EXPORT_SYMBOL_GPL(nfs_show_stats);
689 * Begin unmount by attempting to remove all automounted mountpoints we added
690 * in response to xdev traversals and referrals
692 void nfs_umount_begin(struct super_block *sb)
694 struct nfs_server *server;
695 struct rpc_clnt *rpc;
698 /* -EIO all pending I/O */
699 rpc = server->client_acl;
701 rpc_killall_tasks(rpc);
702 rpc = server->client;
704 rpc_killall_tasks(rpc);
706 EXPORT_SYMBOL_GPL(nfs_umount_begin);
709 * Return true if 'match' is in auth_info or auth_info is empty.
710 * Return false otherwise.
712 bool nfs_auth_info_match(const struct nfs_auth_info *auth_info,
713 rpc_authflavor_t match)
717 if (!auth_info->flavor_len)
720 for (i = 0; i < auth_info->flavor_len; i++) {
721 if (auth_info->flavors[i] == match)
726 EXPORT_SYMBOL_GPL(nfs_auth_info_match);
729 * Ensure that a specified authtype in cfg->auth_info is supported by
730 * the server. Returns 0 and sets cfg->selected_flavor if it's ok, and
733 static int nfs_verify_authflavors(struct nfs_fs_context *cfg,
734 rpc_authflavor_t *server_authlist,
737 rpc_authflavor_t flavor = RPC_AUTH_MAXFLAVOR;
738 bool found_auth_null = false;
742 * If the sec= mount option is used, the specified flavor or AUTH_NULL
743 * must be in the list returned by the server.
745 * AUTH_NULL has a special meaning when it's in the server list - it
746 * means that the server will ignore the rpc creds, so any flavor
747 * can be used but still use the sec= that was specified.
749 * Note also that the MNT procedure in MNTv1 does not return a list
750 * of supported security flavors. In this case, nfs_mount() fabricates
751 * a security flavor list containing just AUTH_NULL.
753 for (i = 0; i < count; i++) {
754 flavor = server_authlist[i];
756 if (nfs_auth_info_match(&cfg->auth_info, flavor))
759 if (flavor == RPC_AUTH_NULL)
760 found_auth_null = true;
763 if (found_auth_null) {
764 flavor = cfg->auth_info.flavors[0];
769 "NFS: specified auth flavors not supported by server\n");
773 cfg->selected_flavor = flavor;
774 dfprintk(MOUNT, "NFS: using auth flavor %u\n", cfg->selected_flavor);
779 * Use the remote server's MOUNT service to request the NFS file handle
780 * corresponding to the provided path.
782 static int nfs_request_mount(struct nfs_fs_context *cfg,
783 struct nfs_fh *root_fh,
784 rpc_authflavor_t *server_authlist,
785 unsigned int *server_authlist_len)
787 struct nfs_mount_request request = {
788 .sap = (struct sockaddr *)
789 &cfg->mount_server.address,
790 .dirpath = cfg->nfs_server.export_path,
791 .protocol = cfg->mount_server.protocol,
793 .noresvport = cfg->flags & NFS_MOUNT_NORESVPORT,
794 .auth_flav_len = server_authlist_len,
795 .auth_flavs = server_authlist,
800 if (cfg->mount_server.version == 0) {
801 switch (cfg->version) {
803 cfg->mount_server.version = NFS_MNT3_VERSION;
806 cfg->mount_server.version = NFS_MNT_VERSION;
809 request.version = cfg->mount_server.version;
811 if (cfg->mount_server.hostname)
812 request.hostname = cfg->mount_server.hostname;
814 request.hostname = cfg->nfs_server.hostname;
817 * Construct the mount server's address.
819 if (cfg->mount_server.address.ss_family == AF_UNSPEC) {
820 memcpy(request.sap, &cfg->nfs_server.address,
821 cfg->nfs_server.addrlen);
822 cfg->mount_server.addrlen = cfg->nfs_server.addrlen;
824 request.salen = cfg->mount_server.addrlen;
825 nfs_set_port(request.sap, &cfg->mount_server.port, 0);
828 * Now ask the mount server to map our export path
831 status = nfs_mount(&request);
833 dfprintk(MOUNT, "NFS: unable to mount server %s, error %d\n",
834 request.hostname, status);
841 static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_info)
845 bool tried_auth_unix = false;
846 bool auth_null_in_list = false;
847 struct nfs_server *server = ERR_PTR(-EACCES);
848 struct nfs_fs_context *ctx = mount_info->ctx;
849 rpc_authflavor_t authlist[NFS_MAX_SECFLAVORS];
850 unsigned int authlist_len = ARRAY_SIZE(authlist);
851 struct nfs_subversion *nfs_mod = mount_info->nfs_mod;
853 status = nfs_request_mount(ctx, mount_info->mntfh, authlist,
856 return ERR_PTR(status);
859 * Was a sec= authflavor specified in the options? First, verify
860 * whether the server supports it, and then just try to use it if so.
862 if (ctx->auth_info.flavor_len > 0) {
863 status = nfs_verify_authflavors(ctx, authlist, authlist_len);
864 dfprintk(MOUNT, "NFS: using auth flavor %u\n",
865 ctx->selected_flavor);
867 return ERR_PTR(status);
868 return nfs_mod->rpc_ops->create_server(mount_info);
872 * No sec= option was provided. RFC 2623, section 2.7 suggests we
873 * SHOULD prefer the flavor listed first. However, some servers list
874 * AUTH_NULL first. Avoid ever choosing AUTH_NULL.
876 for (i = 0; i < authlist_len; ++i) {
877 rpc_authflavor_t flavor;
878 struct rpcsec_gss_info info;
880 flavor = authlist[i];
883 tried_auth_unix = true;
886 auth_null_in_list = true;
889 if (rpcauth_get_gssinfo(flavor, &info) != 0)
893 dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", flavor);
894 ctx->selected_flavor = flavor;
895 server = nfs_mod->rpc_ops->create_server(mount_info);
901 * Nothing we tried so far worked. At this point, give up if we've
902 * already tried AUTH_UNIX or if the server's list doesn't contain
905 if (tried_auth_unix || !auth_null_in_list)
908 /* Last chance! Try AUTH_UNIX */
909 dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", RPC_AUTH_UNIX);
910 ctx->selected_flavor = RPC_AUTH_UNIX;
911 return nfs_mod->rpc_ops->create_server(mount_info);
914 static struct dentry *nfs_fs_mount_common(int, const char *, struct nfs_mount_info *);
916 struct dentry *nfs_try_mount(int flags, const char *dev_name,
917 struct nfs_mount_info *mount_info)
919 struct nfs_subversion *nfs_mod = mount_info->nfs_mod;
920 if (mount_info->ctx->need_mount)
921 mount_info->server = nfs_try_mount_request(mount_info);
923 mount_info->server = nfs_mod->rpc_ops->create_server(mount_info);
925 return nfs_fs_mount_common(flags, dev_name, mount_info);
927 EXPORT_SYMBOL_GPL(nfs_try_mount);
929 #define NFS_REMOUNT_CMP_FLAGMASK ~(NFS_MOUNT_INTR \
933 | NFS_MOUNT_KERBEROS \
935 | NFS_MOUNT_BROKEN_SUID \
936 | NFS_MOUNT_STRICTLOCK \
937 | NFS_MOUNT_LEGACY_INTERFACE)
939 #define NFS_MOUNT_CMP_FLAGMASK (NFS_REMOUNT_CMP_FLAGMASK & \
940 ~(NFS_MOUNT_UNSHARED | NFS_MOUNT_NORESVPORT))
943 nfs_compare_remount_data(struct nfs_server *nfss,
944 struct nfs_fs_context *ctx)
946 if ((ctx->flags ^ nfss->flags) & NFS_REMOUNT_CMP_FLAGMASK ||
947 ctx->rsize != nfss->rsize ||
948 ctx->wsize != nfss->wsize ||
949 ctx->version != nfss->nfs_client->rpc_ops->version ||
950 ctx->minorversion != nfss->nfs_client->cl_minorversion ||
951 ctx->retrans != nfss->client->cl_timeout->to_retries ||
952 !nfs_auth_info_match(&ctx->auth_info, nfss->client->cl_auth->au_flavor) ||
953 ctx->acregmin != nfss->acregmin / HZ ||
954 ctx->acregmax != nfss->acregmax / HZ ||
955 ctx->acdirmin != nfss->acdirmin / HZ ||
956 ctx->acdirmax != nfss->acdirmax / HZ ||
957 ctx->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) ||
958 (ctx->options & NFS_OPTION_FSCACHE) != (nfss->options & NFS_OPTION_FSCACHE) ||
959 ctx->nfs_server.port != nfss->port ||
960 ctx->nfs_server.addrlen != nfss->nfs_client->cl_addrlen ||
961 !rpc_cmp_addr((struct sockaddr *)&ctx->nfs_server.address,
962 (struct sockaddr *)&nfss->nfs_client->cl_addr))
969 nfs_remount(struct super_block *sb, int *flags, char *raw_data)
972 struct nfs_server *nfss = sb->s_fs_info;
973 struct nfs_fs_context *ctx;
974 struct nfs_mount_data *options = (struct nfs_mount_data *)raw_data;
975 struct nfs4_mount_data *options4 = (struct nfs4_mount_data *)raw_data;
976 u32 nfsvers = nfss->nfs_client->rpc_ops->version;
981 * Userspace mount programs that send binary options generally send
982 * them populated with default values. We have no way to know which
983 * ones were explicitly specified. Fall back to legacy behavior and
984 * just return success.
986 if ((nfsvers == 4 && (!options4 || options4->version == 1)) ||
987 (nfsvers <= 3 && (!options || (options->version >= 1 &&
988 options->version <= 6))))
991 ctx = nfs_alloc_parsed_mount_data();
995 /* fill out struct with values from existing mount */
996 ctx->flags = nfss->flags;
997 ctx->rsize = nfss->rsize;
998 ctx->wsize = nfss->wsize;
999 ctx->retrans = nfss->client->cl_timeout->to_retries;
1000 ctx->selected_flavor = nfss->client->cl_auth->au_flavor;
1001 ctx->acregmin = nfss->acregmin / HZ;
1002 ctx->acregmax = nfss->acregmax / HZ;
1003 ctx->acdirmin = nfss->acdirmin / HZ;
1004 ctx->acdirmax = nfss->acdirmax / HZ;
1005 ctx->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ;
1006 ctx->nfs_server.port = nfss->port;
1007 ctx->nfs_server.addrlen = nfss->nfs_client->cl_addrlen;
1008 ctx->version = nfsvers;
1009 ctx->minorversion = nfss->nfs_client->cl_minorversion;
1010 ctx->net = current->nsproxy->net_ns;
1011 memcpy(&ctx->nfs_server.address, &nfss->nfs_client->cl_addr,
1012 ctx->nfs_server.addrlen);
1014 /* overwrite those values with any that were specified */
1016 if (!nfs_parse_mount_options((char *)options, ctx))
1020 * noac is a special case. It implies -o sync, but that's not
1021 * necessarily reflected in the mtab options. do_remount_sb
1022 * will clear SB_SYNCHRONOUS if -o sync wasn't specified in the
1023 * remount options, so we have to explicitly reset it.
1025 if (ctx->flags & NFS_MOUNT_NOAC)
1026 *flags |= SB_SYNCHRONOUS;
1028 /* compare new mount options with old ones */
1029 error = nfs_compare_remount_data(nfss, ctx);
1031 error = security_sb_remount(sb, ctx->lsm_opts);
1033 nfs_free_parsed_mount_data(ctx);
1036 EXPORT_SYMBOL_GPL(nfs_remount);
1039 * Finish setting up an NFS superblock
1041 static void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_info)
1043 struct nfs_fs_context *ctx = mount_info->ctx;
1044 struct nfs_server *server = NFS_SB(sb);
1046 sb->s_blocksize_bits = 0;
1047 sb->s_blocksize = 0;
1048 sb->s_xattr = server->nfs_client->cl_nfs_mod->xattr;
1049 sb->s_op = server->nfs_client->cl_nfs_mod->sops;
1050 if (ctx && ctx->bsize)
1051 sb->s_blocksize = nfs_block_size(ctx->bsize, &sb->s_blocksize_bits);
1053 if (server->nfs_client->rpc_ops->version != 2) {
1054 /* The VFS shouldn't apply the umask to mode bits. We will do
1055 * so ourselves when necessary.
1057 sb->s_flags |= SB_POSIXACL;
1058 sb->s_time_gran = 1;
1059 sb->s_export_op = &nfs_export_ops;
1061 sb->s_time_gran = 1000;
1063 if (server->nfs_client->rpc_ops->version != 4) {
1065 sb->s_time_max = U32_MAX;
1067 sb->s_time_min = S64_MIN;
1068 sb->s_time_max = S64_MAX;
1071 sb->s_magic = NFS_SUPER_MAGIC;
1073 /* We probably want something more informative here */
1074 snprintf(sb->s_id, sizeof(sb->s_id),
1075 "%u:%u", MAJOR(sb->s_dev), MINOR(sb->s_dev));
1077 if (sb->s_blocksize == 0)
1078 sb->s_blocksize = nfs_block_bits(server->wsize,
1079 &sb->s_blocksize_bits);
1081 nfs_super_set_maxbytes(sb, server->maxfilesize);
1084 static int nfs_compare_mount_options(const struct super_block *s, const struct nfs_server *b, int flags)
1086 const struct nfs_server *a = s->s_fs_info;
1087 const struct rpc_clnt *clnt_a = a->client;
1088 const struct rpc_clnt *clnt_b = b->client;
1090 if ((s->s_flags & NFS_MS_MASK) != (flags & NFS_MS_MASK))
1092 if (a->nfs_client != b->nfs_client)
1094 if ((a->flags ^ b->flags) & NFS_MOUNT_CMP_FLAGMASK)
1096 if (a->wsize != b->wsize)
1098 if (a->rsize != b->rsize)
1100 if (a->acregmin != b->acregmin)
1102 if (a->acregmax != b->acregmax)
1104 if (a->acdirmin != b->acdirmin)
1106 if (a->acdirmax != b->acdirmax)
1108 if (clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor)
1115 struct nfs_sb_mountdata {
1116 struct nfs_server *server;
1120 static int nfs_set_super(struct super_block *s, void *data)
1122 struct nfs_sb_mountdata *sb_mntdata = data;
1123 struct nfs_server *server = sb_mntdata->server;
1126 s->s_flags = sb_mntdata->mntflags;
1127 s->s_fs_info = server;
1128 s->s_d_op = server->nfs_client->rpc_ops->dentry_ops;
1129 ret = set_anon_super(s, server);
1131 server->s_dev = s->s_dev;
1135 static int nfs_compare_super_address(struct nfs_server *server1,
1136 struct nfs_server *server2)
1138 struct sockaddr *sap1, *sap2;
1139 struct rpc_xprt *xprt1 = server1->client->cl_xprt;
1140 struct rpc_xprt *xprt2 = server2->client->cl_xprt;
1142 if (!net_eq(xprt1->xprt_net, xprt2->xprt_net))
1145 sap1 = (struct sockaddr *)&server1->nfs_client->cl_addr;
1146 sap2 = (struct sockaddr *)&server2->nfs_client->cl_addr;
1148 if (sap1->sa_family != sap2->sa_family)
1151 switch (sap1->sa_family) {
1153 struct sockaddr_in *sin1 = (struct sockaddr_in *)sap1;
1154 struct sockaddr_in *sin2 = (struct sockaddr_in *)sap2;
1155 if (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr)
1157 if (sin1->sin_port != sin2->sin_port)
1162 struct sockaddr_in6 *sin1 = (struct sockaddr_in6 *)sap1;
1163 struct sockaddr_in6 *sin2 = (struct sockaddr_in6 *)sap2;
1164 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
1166 if (sin1->sin6_port != sin2->sin6_port)
1177 static int nfs_compare_userns(const struct nfs_server *old,
1178 const struct nfs_server *new)
1180 const struct user_namespace *oldns = &init_user_ns;
1181 const struct user_namespace *newns = &init_user_ns;
1183 if (old->client && old->client->cl_cred)
1184 oldns = old->client->cl_cred->user_ns;
1185 if (new->client && new->client->cl_cred)
1186 newns = new->client->cl_cred->user_ns;
1192 static int nfs_compare_super(struct super_block *sb, void *data)
1194 struct nfs_sb_mountdata *sb_mntdata = data;
1195 struct nfs_server *server = sb_mntdata->server, *old = NFS_SB(sb);
1196 int mntflags = sb_mntdata->mntflags;
1198 if (!nfs_compare_super_address(old, server))
1200 /* Note: NFS_MOUNT_UNSHARED == NFS4_MOUNT_UNSHARED */
1201 if (old->flags & NFS_MOUNT_UNSHARED)
1203 if (memcmp(&old->fsid, &server->fsid, sizeof(old->fsid)) != 0)
1205 if (!nfs_compare_userns(old, server))
1207 return nfs_compare_mount_options(sb, server, mntflags);
1210 #ifdef CONFIG_NFS_FSCACHE
1211 static void nfs_get_cache_cookie(struct super_block *sb,
1212 struct nfs_fs_context *ctx,
1213 struct nfs_clone_mount *cloned)
1215 struct nfs_server *nfss = NFS_SB(sb);
1219 nfss->fscache_key = NULL;
1220 nfss->fscache = NULL;
1223 if (!(ctx->options & NFS_OPTION_FSCACHE))
1225 if (ctx->fscache_uniq) {
1226 uniq = ctx->fscache_uniq;
1227 ulen = strlen(ctx->fscache_uniq);
1229 } else if (cloned) {
1230 struct nfs_server *mnt_s = NFS_SB(cloned->sb);
1231 if (!(mnt_s->options & NFS_OPTION_FSCACHE))
1233 if (mnt_s->fscache_key) {
1234 uniq = mnt_s->fscache_key->key.uniquifier;
1235 ulen = mnt_s->fscache_key->key.uniq_len;
1240 nfs_fscache_get_super_cookie(sb, uniq, ulen);
1243 static void nfs_get_cache_cookie(struct super_block *sb,
1244 struct nfs_fs_context *parsed,
1245 struct nfs_clone_mount *cloned)
1250 static void nfs_set_readahead(struct backing_dev_info *bdi,
1251 unsigned long iomax_pages)
1253 bdi->ra_pages = VM_READAHEAD_PAGES;
1254 bdi->io_pages = iomax_pages;
1257 static struct dentry *nfs_fs_mount_common(int flags, const char *dev_name,
1258 struct nfs_mount_info *mount_info)
1260 struct super_block *s;
1261 struct dentry *mntroot = ERR_PTR(-ENOMEM);
1262 int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
1263 struct nfs_server *server = mount_info->server;
1264 unsigned long kflags = 0, kflags_out = 0;
1265 struct nfs_sb_mountdata sb_mntdata = {
1271 mount_info->server = NULL;
1273 return ERR_CAST(server);
1275 if (server->flags & NFS_MOUNT_UNSHARED)
1276 compare_super = NULL;
1278 /* -o noac implies -o sync */
1279 if (server->flags & NFS_MOUNT_NOAC)
1280 sb_mntdata.mntflags |= SB_SYNCHRONOUS;
1282 if (mount_info->cloned != NULL && mount_info->cloned->sb != NULL)
1283 if (mount_info->cloned->sb->s_flags & SB_SYNCHRONOUS)
1284 sb_mntdata.mntflags |= SB_SYNCHRONOUS;
1286 /* Get a superblock - note that we may end up sharing one that already exists */
1287 s = sget(mount_info->nfs_mod->nfs_fs, compare_super, nfs_set_super,
1288 flags, &sb_mntdata);
1290 mntroot = ERR_CAST(s);
1294 if (s->s_fs_info != server) {
1295 nfs_free_server(server);
1298 error = super_setup_bdi_name(s, "%u:%u", MAJOR(server->s_dev),
1299 MINOR(server->s_dev));
1301 mntroot = ERR_PTR(error);
1302 goto error_splat_super;
1304 nfs_set_readahead(s->s_bdi, server->rpages);
1309 unsigned bsize = mount_info->inherited_bsize;
1310 /* initial superblock/root creation */
1311 nfs_fill_super(s, mount_info);
1313 s->s_blocksize_bits = bsize;
1314 s->s_blocksize = 1U << bsize;
1316 nfs_get_cache_cookie(s, mount_info->ctx, mount_info->cloned);
1317 if (!(server->flags & NFS_MOUNT_UNSHARED))
1318 s->s_iflags |= SB_I_MULTIROOT;
1321 mntroot = nfs_get_root(s, mount_info->mntfh, dev_name);
1322 if (IS_ERR(mntroot))
1323 goto error_splat_super;
1326 if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL)
1327 kflags |= SECURITY_LSM_NATIVE_LABELS;
1328 if (mount_info->cloned) {
1329 if (d_inode(mntroot)->i_fop != &nfs_dir_operations) {
1331 goto error_splat_root;
1333 /* clone any lsm security options from the parent to the new sb */
1334 error = security_sb_clone_mnt_opts(mount_info->cloned->sb, s, kflags,
1337 error = security_sb_set_mnt_opts(s, mount_info->ctx->lsm_opts,
1338 kflags, &kflags_out);
1341 goto error_splat_root;
1342 if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL &&
1343 !(kflags_out & SECURITY_LSM_NATIVE_LABELS))
1344 NFS_SB(s)->caps &= ~NFS_CAP_SECURITY_LABEL;
1346 goto error_splat_root;
1348 s->s_flags |= SB_ACTIVE;
1354 nfs_free_server(server);
1359 mntroot = ERR_PTR(error);
1361 deactivate_locked_super(s);
1365 struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
1366 int flags, const char *dev_name, void *raw_data)
1368 struct nfs_mount_info mount_info = {
1370 struct dentry *mntroot = ERR_PTR(-ENOMEM);
1371 struct nfs_subversion *nfs_mod;
1374 mount_info.ctx = nfs_alloc_parsed_mount_data();
1375 mount_info.mntfh = nfs_alloc_fhandle();
1376 if (mount_info.ctx == NULL || mount_info.mntfh == NULL)
1379 /* Validate the mount data */
1380 error = nfs_validate_mount_data(fs_type, raw_data, mount_info.ctx, mount_info.mntfh, dev_name);
1381 if (error == NFS_TEXT_DATA)
1382 error = nfs_validate_text_mount_data(raw_data,
1383 mount_info.ctx, dev_name);
1385 mntroot = ERR_PTR(error);
1389 nfs_mod = get_nfs_version(mount_info.ctx->version);
1390 if (IS_ERR(nfs_mod)) {
1391 mntroot = ERR_CAST(nfs_mod);
1394 mount_info.nfs_mod = nfs_mod;
1396 mntroot = nfs_mod->rpc_ops->try_mount(flags, dev_name, &mount_info);
1398 put_nfs_version(nfs_mod);
1400 nfs_free_parsed_mount_data(mount_info.ctx);
1401 nfs_free_fhandle(mount_info.mntfh);
1404 EXPORT_SYMBOL_GPL(nfs_fs_mount);
1407 * Destroy an NFS2/3 superblock
1409 void nfs_kill_super(struct super_block *s)
1411 struct nfs_server *server = NFS_SB(s);
1412 dev_t dev = s->s_dev;
1414 generic_shutdown_super(s);
1416 nfs_fscache_release_super_cookie(s);
1418 nfs_free_server(server);
1419 free_anon_bdev(dev);
1421 EXPORT_SYMBOL_GPL(nfs_kill_super);
1424 * Internal use only: mount_info is already set up by caller.
1425 * Used for mountpoint crossings and for nfs4 root.
1427 static struct dentry *
1428 nfs_prepared_mount(struct file_system_type *fs_type, int flags,
1429 const char *dev_name, void *raw_data)
1431 return nfs_fs_mount_common(flags, dev_name, raw_data);
1434 #if IS_ENABLED(CONFIG_NFS_V4)
1437 * NFS v4 module parameters need to stay in the
1438 * NFS client for backwards compatibility
1440 unsigned int nfs_callback_set_tcpport;
1441 unsigned short nfs_callback_nr_threads;
1442 /* Default cache timeout is 10 minutes */
1443 unsigned int nfs_idmap_cache_timeout = 600;
1444 /* Turn off NFSv4 uid/gid mapping when using AUTH_SYS */
1445 bool nfs4_disable_idmapping = true;
1446 unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE;
1447 unsigned short max_session_cb_slots = NFS4_DEF_CB_SLOT_TABLE_SIZE;
1448 unsigned short send_implementation_id = 1;
1449 char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN] = "";
1450 bool recover_lost_locks = false;
1452 EXPORT_SYMBOL_GPL(nfs_callback_nr_threads);
1453 EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport);
1454 EXPORT_SYMBOL_GPL(nfs_idmap_cache_timeout);
1455 EXPORT_SYMBOL_GPL(nfs4_disable_idmapping);
1456 EXPORT_SYMBOL_GPL(max_session_slots);
1457 EXPORT_SYMBOL_GPL(max_session_cb_slots);
1458 EXPORT_SYMBOL_GPL(send_implementation_id);
1459 EXPORT_SYMBOL_GPL(nfs4_client_id_uniquifier);
1460 EXPORT_SYMBOL_GPL(recover_lost_locks);
1462 #define NFS_CALLBACK_MAXPORTNR (65535U)
1464 static int param_set_portnr(const char *val, const struct kernel_param *kp)
1471 ret = kstrtoul(val, 0, &num);
1472 if (ret || num > NFS_CALLBACK_MAXPORTNR)
1474 *((unsigned int *)kp->arg) = num;
1477 static const struct kernel_param_ops param_ops_portnr = {
1478 .set = param_set_portnr,
1479 .get = param_get_uint,
1481 #define param_check_portnr(name, p) __param_check(name, p, unsigned int);
1483 module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644);
1484 module_param_named(callback_nr_threads, nfs_callback_nr_threads, ushort, 0644);
1485 MODULE_PARM_DESC(callback_nr_threads, "Number of threads that will be "
1486 "assigned to the NFSv4 callback channels.");
1487 module_param(nfs_idmap_cache_timeout, int, 0644);
1488 module_param(nfs4_disable_idmapping, bool, 0644);
1489 module_param_string(nfs4_unique_id, nfs4_client_id_uniquifier,
1490 NFS4_CLIENT_ID_UNIQ_LEN, 0600);
1491 MODULE_PARM_DESC(nfs4_disable_idmapping,
1492 "Turn off NFSv4 idmapping when using 'sec=sys'");
1493 module_param(max_session_slots, ushort, 0644);
1494 MODULE_PARM_DESC(max_session_slots, "Maximum number of outstanding NFSv4.1 "
1495 "requests the client will negotiate");
1496 module_param(max_session_cb_slots, ushort, 0644);
1497 MODULE_PARM_DESC(max_session_cb_slots, "Maximum number of parallel NFSv4.1 "
1498 "callbacks the client will process for a given server");
1499 module_param(send_implementation_id, ushort, 0644);
1500 MODULE_PARM_DESC(send_implementation_id,
1501 "Send implementation ID with NFSv4.1 exchange_id");
1502 MODULE_PARM_DESC(nfs4_unique_id, "nfs_client_id4 uniquifier string");
1504 module_param(recover_lost_locks, bool, 0644);
1505 MODULE_PARM_DESC(recover_lost_locks,
1506 "If the server reports that a lock might be lost, "
1507 "try to recover it risking data corruption.");
1510 #endif /* CONFIG_NFS_V4 */