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 args->auth_info is supported by
730 * the server. Returns 0 and sets args->selected_flavor if it's ok, and
733 static int nfs_verify_authflavors(struct nfs_parsed_mount_data *args,
734 rpc_authflavor_t *server_authlist, unsigned int count)
736 rpc_authflavor_t flavor = RPC_AUTH_MAXFLAVOR;
737 bool found_auth_null = false;
741 * If the sec= mount option is used, the specified flavor or AUTH_NULL
742 * must be in the list returned by the server.
744 * AUTH_NULL has a special meaning when it's in the server list - it
745 * means that the server will ignore the rpc creds, so any flavor
746 * can be used but still use the sec= that was specified.
748 * Note also that the MNT procedure in MNTv1 does not return a list
749 * of supported security flavors. In this case, nfs_mount() fabricates
750 * a security flavor list containing just AUTH_NULL.
752 for (i = 0; i < count; i++) {
753 flavor = server_authlist[i];
755 if (nfs_auth_info_match(&args->auth_info, flavor))
758 if (flavor == RPC_AUTH_NULL)
759 found_auth_null = true;
762 if (found_auth_null) {
763 flavor = args->auth_info.flavors[0];
768 "NFS: specified auth flavors not supported by server\n");
772 args->selected_flavor = flavor;
773 dfprintk(MOUNT, "NFS: using auth flavor %u\n", args->selected_flavor);
778 * Use the remote server's MOUNT service to request the NFS file handle
779 * corresponding to the provided path.
781 static int nfs_request_mount(struct nfs_parsed_mount_data *args,
782 struct nfs_fh *root_fh,
783 rpc_authflavor_t *server_authlist,
784 unsigned int *server_authlist_len)
786 struct nfs_mount_request request = {
787 .sap = (struct sockaddr *)
788 &args->mount_server.address,
789 .dirpath = args->nfs_server.export_path,
790 .protocol = args->mount_server.protocol,
792 .noresvport = args->flags & NFS_MOUNT_NORESVPORT,
793 .auth_flav_len = server_authlist_len,
794 .auth_flavs = server_authlist,
799 if (args->mount_server.version == 0) {
800 switch (args->version) {
802 args->mount_server.version = NFS_MNT3_VERSION;
805 args->mount_server.version = NFS_MNT_VERSION;
808 request.version = args->mount_server.version;
810 if (args->mount_server.hostname)
811 request.hostname = args->mount_server.hostname;
813 request.hostname = args->nfs_server.hostname;
816 * Construct the mount server's address.
818 if (args->mount_server.address.ss_family == AF_UNSPEC) {
819 memcpy(request.sap, &args->nfs_server.address,
820 args->nfs_server.addrlen);
821 args->mount_server.addrlen = args->nfs_server.addrlen;
823 request.salen = args->mount_server.addrlen;
824 nfs_set_port(request.sap, &args->mount_server.port, 0);
827 * Now ask the mount server to map our export path
830 status = nfs_mount(&request);
832 dfprintk(MOUNT, "NFS: unable to mount server %s, error %d\n",
833 request.hostname, status);
840 static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_info)
844 bool tried_auth_unix = false;
845 bool auth_null_in_list = false;
846 struct nfs_server *server = ERR_PTR(-EACCES);
847 struct nfs_parsed_mount_data *args = mount_info->parsed;
848 rpc_authflavor_t authlist[NFS_MAX_SECFLAVORS];
849 unsigned int authlist_len = ARRAY_SIZE(authlist);
850 struct nfs_subversion *nfs_mod = mount_info->nfs_mod;
852 status = nfs_request_mount(args, mount_info->mntfh, authlist,
855 return ERR_PTR(status);
858 * Was a sec= authflavor specified in the options? First, verify
859 * whether the server supports it, and then just try to use it if so.
861 if (args->auth_info.flavor_len > 0) {
862 status = nfs_verify_authflavors(args, authlist, authlist_len);
863 dfprintk(MOUNT, "NFS: using auth flavor %u\n",
864 args->selected_flavor);
866 return ERR_PTR(status);
867 return nfs_mod->rpc_ops->create_server(mount_info);
871 * No sec= option was provided. RFC 2623, section 2.7 suggests we
872 * SHOULD prefer the flavor listed first. However, some servers list
873 * AUTH_NULL first. Avoid ever choosing AUTH_NULL.
875 for (i = 0; i < authlist_len; ++i) {
876 rpc_authflavor_t flavor;
877 struct rpcsec_gss_info info;
879 flavor = authlist[i];
882 tried_auth_unix = true;
885 auth_null_in_list = true;
888 if (rpcauth_get_gssinfo(flavor, &info) != 0)
892 dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", flavor);
893 args->selected_flavor = flavor;
894 server = nfs_mod->rpc_ops->create_server(mount_info);
900 * Nothing we tried so far worked. At this point, give up if we've
901 * already tried AUTH_UNIX or if the server's list doesn't contain
904 if (tried_auth_unix || !auth_null_in_list)
907 /* Last chance! Try AUTH_UNIX */
908 dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", RPC_AUTH_UNIX);
909 args->selected_flavor = RPC_AUTH_UNIX;
910 return nfs_mod->rpc_ops->create_server(mount_info);
913 static struct dentry *nfs_fs_mount_common(int, const char *, struct nfs_mount_info *);
915 struct dentry *nfs_try_mount(int flags, const char *dev_name,
916 struct nfs_mount_info *mount_info)
918 struct nfs_subversion *nfs_mod = mount_info->nfs_mod;
919 if (mount_info->parsed->need_mount)
920 mount_info->server = nfs_try_mount_request(mount_info);
922 mount_info->server = nfs_mod->rpc_ops->create_server(mount_info);
924 return nfs_fs_mount_common(flags, dev_name, mount_info);
926 EXPORT_SYMBOL_GPL(nfs_try_mount);
928 #define NFS_REMOUNT_CMP_FLAGMASK ~(NFS_MOUNT_INTR \
932 | NFS_MOUNT_KERBEROS \
934 | NFS_MOUNT_BROKEN_SUID \
935 | NFS_MOUNT_STRICTLOCK \
936 | NFS_MOUNT_LEGACY_INTERFACE)
938 #define NFS_MOUNT_CMP_FLAGMASK (NFS_REMOUNT_CMP_FLAGMASK & \
939 ~(NFS_MOUNT_UNSHARED | NFS_MOUNT_NORESVPORT))
942 nfs_compare_remount_data(struct nfs_server *nfss,
943 struct nfs_parsed_mount_data *data)
945 if ((data->flags ^ nfss->flags) & NFS_REMOUNT_CMP_FLAGMASK ||
946 data->rsize != nfss->rsize ||
947 data->wsize != nfss->wsize ||
948 data->version != nfss->nfs_client->rpc_ops->version ||
949 data->minorversion != nfss->nfs_client->cl_minorversion ||
950 data->retrans != nfss->client->cl_timeout->to_retries ||
951 !nfs_auth_info_match(&data->auth_info, nfss->client->cl_auth->au_flavor) ||
952 data->acregmin != nfss->acregmin / HZ ||
953 data->acregmax != nfss->acregmax / HZ ||
954 data->acdirmin != nfss->acdirmin / HZ ||
955 data->acdirmax != nfss->acdirmax / HZ ||
956 data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) ||
957 (data->options & NFS_OPTION_FSCACHE) != (nfss->options & NFS_OPTION_FSCACHE) ||
958 data->nfs_server.port != nfss->port ||
959 data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen ||
960 !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address,
961 (struct sockaddr *)&nfss->nfs_client->cl_addr))
968 nfs_remount(struct super_block *sb, int *flags, char *raw_data)
971 struct nfs_server *nfss = sb->s_fs_info;
972 struct nfs_parsed_mount_data *data;
973 struct nfs_mount_data *options = (struct nfs_mount_data *)raw_data;
974 struct nfs4_mount_data *options4 = (struct nfs4_mount_data *)raw_data;
975 u32 nfsvers = nfss->nfs_client->rpc_ops->version;
980 * Userspace mount programs that send binary options generally send
981 * them populated with default values. We have no way to know which
982 * ones were explicitly specified. Fall back to legacy behavior and
983 * just return success.
985 if ((nfsvers == 4 && (!options4 || options4->version == 1)) ||
986 (nfsvers <= 3 && (!options || (options->version >= 1 &&
987 options->version <= 6))))
990 data = nfs_alloc_parsed_mount_data();
994 /* fill out struct with values from existing mount */
995 data->flags = nfss->flags;
996 data->rsize = nfss->rsize;
997 data->wsize = nfss->wsize;
998 data->retrans = nfss->client->cl_timeout->to_retries;
999 data->selected_flavor = nfss->client->cl_auth->au_flavor;
1000 data->acregmin = nfss->acregmin / HZ;
1001 data->acregmax = nfss->acregmax / HZ;
1002 data->acdirmin = nfss->acdirmin / HZ;
1003 data->acdirmax = nfss->acdirmax / HZ;
1004 data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ;
1005 data->nfs_server.port = nfss->port;
1006 data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen;
1007 data->version = nfsvers;
1008 data->minorversion = nfss->nfs_client->cl_minorversion;
1009 data->net = current->nsproxy->net_ns;
1010 memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr,
1011 data->nfs_server.addrlen);
1013 /* overwrite those values with any that were specified */
1015 if (!nfs_parse_mount_options((char *)options, data))
1019 * noac is a special case. It implies -o sync, but that's not
1020 * necessarily reflected in the mtab options. do_remount_sb
1021 * will clear SB_SYNCHRONOUS if -o sync wasn't specified in the
1022 * remount options, so we have to explicitly reset it.
1024 if (data->flags & NFS_MOUNT_NOAC)
1025 *flags |= SB_SYNCHRONOUS;
1027 /* compare new mount options with old ones */
1028 error = nfs_compare_remount_data(nfss, data);
1030 error = security_sb_remount(sb, data->lsm_opts);
1032 nfs_free_parsed_mount_data(data);
1035 EXPORT_SYMBOL_GPL(nfs_remount);
1038 * Finish setting up an NFS superblock
1040 static void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_info)
1042 struct nfs_parsed_mount_data *data = mount_info->parsed;
1043 struct nfs_server *server = NFS_SB(sb);
1045 sb->s_blocksize_bits = 0;
1046 sb->s_blocksize = 0;
1047 sb->s_xattr = server->nfs_client->cl_nfs_mod->xattr;
1048 sb->s_op = server->nfs_client->cl_nfs_mod->sops;
1049 if (data && data->bsize)
1050 sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits);
1052 if (server->nfs_client->rpc_ops->version != 2) {
1053 /* The VFS shouldn't apply the umask to mode bits. We will do
1054 * so ourselves when necessary.
1056 sb->s_flags |= SB_POSIXACL;
1057 sb->s_time_gran = 1;
1058 sb->s_export_op = &nfs_export_ops;
1060 sb->s_time_gran = 1000;
1062 if (server->nfs_client->rpc_ops->version != 4) {
1064 sb->s_time_max = U32_MAX;
1066 sb->s_time_min = S64_MIN;
1067 sb->s_time_max = S64_MAX;
1070 sb->s_magic = NFS_SUPER_MAGIC;
1072 /* We probably want something more informative here */
1073 snprintf(sb->s_id, sizeof(sb->s_id),
1074 "%u:%u", MAJOR(sb->s_dev), MINOR(sb->s_dev));
1076 if (sb->s_blocksize == 0)
1077 sb->s_blocksize = nfs_block_bits(server->wsize,
1078 &sb->s_blocksize_bits);
1080 nfs_super_set_maxbytes(sb, server->maxfilesize);
1083 static int nfs_compare_mount_options(const struct super_block *s, const struct nfs_server *b, int flags)
1085 const struct nfs_server *a = s->s_fs_info;
1086 const struct rpc_clnt *clnt_a = a->client;
1087 const struct rpc_clnt *clnt_b = b->client;
1089 if ((s->s_flags & NFS_MS_MASK) != (flags & NFS_MS_MASK))
1091 if (a->nfs_client != b->nfs_client)
1093 if ((a->flags ^ b->flags) & NFS_MOUNT_CMP_FLAGMASK)
1095 if (a->wsize != b->wsize)
1097 if (a->rsize != b->rsize)
1099 if (a->acregmin != b->acregmin)
1101 if (a->acregmax != b->acregmax)
1103 if (a->acdirmin != b->acdirmin)
1105 if (a->acdirmax != b->acdirmax)
1107 if (clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor)
1114 struct nfs_sb_mountdata {
1115 struct nfs_server *server;
1119 static int nfs_set_super(struct super_block *s, void *data)
1121 struct nfs_sb_mountdata *sb_mntdata = data;
1122 struct nfs_server *server = sb_mntdata->server;
1125 s->s_flags = sb_mntdata->mntflags;
1126 s->s_fs_info = server;
1127 s->s_d_op = server->nfs_client->rpc_ops->dentry_ops;
1128 ret = set_anon_super(s, server);
1130 server->s_dev = s->s_dev;
1134 static int nfs_compare_super_address(struct nfs_server *server1,
1135 struct nfs_server *server2)
1137 struct sockaddr *sap1, *sap2;
1138 struct rpc_xprt *xprt1 = server1->client->cl_xprt;
1139 struct rpc_xprt *xprt2 = server2->client->cl_xprt;
1141 if (!net_eq(xprt1->xprt_net, xprt2->xprt_net))
1144 sap1 = (struct sockaddr *)&server1->nfs_client->cl_addr;
1145 sap2 = (struct sockaddr *)&server2->nfs_client->cl_addr;
1147 if (sap1->sa_family != sap2->sa_family)
1150 switch (sap1->sa_family) {
1152 struct sockaddr_in *sin1 = (struct sockaddr_in *)sap1;
1153 struct sockaddr_in *sin2 = (struct sockaddr_in *)sap2;
1154 if (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr)
1156 if (sin1->sin_port != sin2->sin_port)
1161 struct sockaddr_in6 *sin1 = (struct sockaddr_in6 *)sap1;
1162 struct sockaddr_in6 *sin2 = (struct sockaddr_in6 *)sap2;
1163 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
1165 if (sin1->sin6_port != sin2->sin6_port)
1176 static int nfs_compare_userns(const struct nfs_server *old,
1177 const struct nfs_server *new)
1179 const struct user_namespace *oldns = &init_user_ns;
1180 const struct user_namespace *newns = &init_user_ns;
1182 if (old->client && old->client->cl_cred)
1183 oldns = old->client->cl_cred->user_ns;
1184 if (new->client && new->client->cl_cred)
1185 newns = new->client->cl_cred->user_ns;
1191 static int nfs_compare_super(struct super_block *sb, void *data)
1193 struct nfs_sb_mountdata *sb_mntdata = data;
1194 struct nfs_server *server = sb_mntdata->server, *old = NFS_SB(sb);
1195 int mntflags = sb_mntdata->mntflags;
1197 if (!nfs_compare_super_address(old, server))
1199 /* Note: NFS_MOUNT_UNSHARED == NFS4_MOUNT_UNSHARED */
1200 if (old->flags & NFS_MOUNT_UNSHARED)
1202 if (memcmp(&old->fsid, &server->fsid, sizeof(old->fsid)) != 0)
1204 if (!nfs_compare_userns(old, server))
1206 return nfs_compare_mount_options(sb, server, mntflags);
1209 #ifdef CONFIG_NFS_FSCACHE
1210 static void nfs_get_cache_cookie(struct super_block *sb,
1211 struct nfs_parsed_mount_data *parsed,
1212 struct nfs_clone_mount *cloned)
1214 struct nfs_server *nfss = NFS_SB(sb);
1218 nfss->fscache_key = NULL;
1219 nfss->fscache = NULL;
1222 if (!(parsed->options & NFS_OPTION_FSCACHE))
1224 if (parsed->fscache_uniq) {
1225 uniq = parsed->fscache_uniq;
1226 ulen = strlen(parsed->fscache_uniq);
1228 } else if (cloned) {
1229 struct nfs_server *mnt_s = NFS_SB(cloned->sb);
1230 if (!(mnt_s->options & NFS_OPTION_FSCACHE))
1232 if (mnt_s->fscache_key) {
1233 uniq = mnt_s->fscache_key->key.uniquifier;
1234 ulen = mnt_s->fscache_key->key.uniq_len;
1239 nfs_fscache_get_super_cookie(sb, uniq, ulen);
1242 static void nfs_get_cache_cookie(struct super_block *sb,
1243 struct nfs_parsed_mount_data *parsed,
1244 struct nfs_clone_mount *cloned)
1249 static void nfs_set_readahead(struct backing_dev_info *bdi,
1250 unsigned long iomax_pages)
1252 bdi->ra_pages = VM_READAHEAD_PAGES;
1253 bdi->io_pages = iomax_pages;
1256 static struct dentry *nfs_fs_mount_common(int flags, const char *dev_name,
1257 struct nfs_mount_info *mount_info)
1259 struct super_block *s;
1260 struct dentry *mntroot = ERR_PTR(-ENOMEM);
1261 int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
1262 struct nfs_server *server = mount_info->server;
1263 unsigned long kflags = 0, kflags_out = 0;
1264 struct nfs_sb_mountdata sb_mntdata = {
1270 mount_info->server = NULL;
1272 return ERR_CAST(server);
1274 if (server->flags & NFS_MOUNT_UNSHARED)
1275 compare_super = NULL;
1277 /* -o noac implies -o sync */
1278 if (server->flags & NFS_MOUNT_NOAC)
1279 sb_mntdata.mntflags |= SB_SYNCHRONOUS;
1281 if (mount_info->cloned != NULL && mount_info->cloned->sb != NULL)
1282 if (mount_info->cloned->sb->s_flags & SB_SYNCHRONOUS)
1283 sb_mntdata.mntflags |= SB_SYNCHRONOUS;
1285 /* Get a superblock - note that we may end up sharing one that already exists */
1286 s = sget(mount_info->nfs_mod->nfs_fs, compare_super, nfs_set_super,
1287 flags, &sb_mntdata);
1289 mntroot = ERR_CAST(s);
1293 if (s->s_fs_info != server) {
1294 nfs_free_server(server);
1297 error = super_setup_bdi_name(s, "%u:%u", MAJOR(server->s_dev),
1298 MINOR(server->s_dev));
1300 mntroot = ERR_PTR(error);
1301 goto error_splat_super;
1303 nfs_set_readahead(s->s_bdi, server->rpages);
1308 unsigned bsize = mount_info->inherited_bsize;
1309 /* initial superblock/root creation */
1310 nfs_fill_super(s, mount_info);
1312 s->s_blocksize_bits = bsize;
1313 s->s_blocksize = 1U << bsize;
1315 nfs_get_cache_cookie(s, mount_info->parsed, mount_info->cloned);
1316 if (!(server->flags & NFS_MOUNT_UNSHARED))
1317 s->s_iflags |= SB_I_MULTIROOT;
1320 mntroot = nfs_get_root(s, mount_info->mntfh, dev_name);
1321 if (IS_ERR(mntroot))
1322 goto error_splat_super;
1325 if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL)
1326 kflags |= SECURITY_LSM_NATIVE_LABELS;
1327 if (mount_info->cloned) {
1328 if (d_inode(mntroot)->i_fop != &nfs_dir_operations) {
1330 goto error_splat_root;
1332 /* clone any lsm security options from the parent to the new sb */
1333 error = security_sb_clone_mnt_opts(mount_info->cloned->sb, s, kflags,
1336 error = security_sb_set_mnt_opts(s, mount_info->parsed->lsm_opts,
1337 kflags, &kflags_out);
1340 goto error_splat_root;
1341 if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL &&
1342 !(kflags_out & SECURITY_LSM_NATIVE_LABELS))
1343 NFS_SB(s)->caps &= ~NFS_CAP_SECURITY_LABEL;
1345 goto error_splat_root;
1347 s->s_flags |= SB_ACTIVE;
1353 nfs_free_server(server);
1358 mntroot = ERR_PTR(error);
1360 deactivate_locked_super(s);
1364 struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
1365 int flags, const char *dev_name, void *raw_data)
1367 struct nfs_mount_info mount_info = {
1369 struct dentry *mntroot = ERR_PTR(-ENOMEM);
1370 struct nfs_subversion *nfs_mod;
1373 mount_info.parsed = nfs_alloc_parsed_mount_data();
1374 mount_info.mntfh = nfs_alloc_fhandle();
1375 if (mount_info.parsed == NULL || mount_info.mntfh == NULL)
1378 /* Validate the mount data */
1379 error = nfs_validate_mount_data(fs_type, raw_data, mount_info.parsed, mount_info.mntfh, dev_name);
1380 if (error == NFS_TEXT_DATA)
1381 error = nfs_validate_text_mount_data(raw_data, mount_info.parsed, dev_name);
1383 mntroot = ERR_PTR(error);
1387 nfs_mod = get_nfs_version(mount_info.parsed->version);
1388 if (IS_ERR(nfs_mod)) {
1389 mntroot = ERR_CAST(nfs_mod);
1392 mount_info.nfs_mod = nfs_mod;
1394 mntroot = nfs_mod->rpc_ops->try_mount(flags, dev_name, &mount_info);
1396 put_nfs_version(nfs_mod);
1398 nfs_free_parsed_mount_data(mount_info.parsed);
1399 nfs_free_fhandle(mount_info.mntfh);
1402 EXPORT_SYMBOL_GPL(nfs_fs_mount);
1405 * Destroy an NFS2/3 superblock
1407 void nfs_kill_super(struct super_block *s)
1409 struct nfs_server *server = NFS_SB(s);
1410 dev_t dev = s->s_dev;
1412 generic_shutdown_super(s);
1414 nfs_fscache_release_super_cookie(s);
1416 nfs_free_server(server);
1417 free_anon_bdev(dev);
1419 EXPORT_SYMBOL_GPL(nfs_kill_super);
1422 * Internal use only: mount_info is already set up by caller.
1423 * Used for mountpoint crossings and for nfs4 root.
1425 static struct dentry *
1426 nfs_prepared_mount(struct file_system_type *fs_type, int flags,
1427 const char *dev_name, void *raw_data)
1429 return nfs_fs_mount_common(flags, dev_name, raw_data);
1432 #if IS_ENABLED(CONFIG_NFS_V4)
1435 * NFS v4 module parameters need to stay in the
1436 * NFS client for backwards compatibility
1438 unsigned int nfs_callback_set_tcpport;
1439 unsigned short nfs_callback_nr_threads;
1440 /* Default cache timeout is 10 minutes */
1441 unsigned int nfs_idmap_cache_timeout = 600;
1442 /* Turn off NFSv4 uid/gid mapping when using AUTH_SYS */
1443 bool nfs4_disable_idmapping = true;
1444 unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE;
1445 unsigned short max_session_cb_slots = NFS4_DEF_CB_SLOT_TABLE_SIZE;
1446 unsigned short send_implementation_id = 1;
1447 char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN] = "";
1448 bool recover_lost_locks = false;
1450 EXPORT_SYMBOL_GPL(nfs_callback_nr_threads);
1451 EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport);
1452 EXPORT_SYMBOL_GPL(nfs_idmap_cache_timeout);
1453 EXPORT_SYMBOL_GPL(nfs4_disable_idmapping);
1454 EXPORT_SYMBOL_GPL(max_session_slots);
1455 EXPORT_SYMBOL_GPL(max_session_cb_slots);
1456 EXPORT_SYMBOL_GPL(send_implementation_id);
1457 EXPORT_SYMBOL_GPL(nfs4_client_id_uniquifier);
1458 EXPORT_SYMBOL_GPL(recover_lost_locks);
1460 #define NFS_CALLBACK_MAXPORTNR (65535U)
1462 static int param_set_portnr(const char *val, const struct kernel_param *kp)
1469 ret = kstrtoul(val, 0, &num);
1470 if (ret || num > NFS_CALLBACK_MAXPORTNR)
1472 *((unsigned int *)kp->arg) = num;
1475 static const struct kernel_param_ops param_ops_portnr = {
1476 .set = param_set_portnr,
1477 .get = param_get_uint,
1479 #define param_check_portnr(name, p) __param_check(name, p, unsigned int);
1481 module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644);
1482 module_param_named(callback_nr_threads, nfs_callback_nr_threads, ushort, 0644);
1483 MODULE_PARM_DESC(callback_nr_threads, "Number of threads that will be "
1484 "assigned to the NFSv4 callback channels.");
1485 module_param(nfs_idmap_cache_timeout, int, 0644);
1486 module_param(nfs4_disable_idmapping, bool, 0644);
1487 module_param_string(nfs4_unique_id, nfs4_client_id_uniquifier,
1488 NFS4_CLIENT_ID_UNIQ_LEN, 0600);
1489 MODULE_PARM_DESC(nfs4_disable_idmapping,
1490 "Turn off NFSv4 idmapping when using 'sec=sys'");
1491 module_param(max_session_slots, ushort, 0644);
1492 MODULE_PARM_DESC(max_session_slots, "Maximum number of outstanding NFSv4.1 "
1493 "requests the client will negotiate");
1494 module_param(max_session_cb_slots, ushort, 0644);
1495 MODULE_PARM_DESC(max_session_cb_slots, "Maximum number of parallel NFSv4.1 "
1496 "callbacks the client will process for a given server");
1497 module_param(send_implementation_id, ushort, 0644);
1498 MODULE_PARM_DESC(send_implementation_id,
1499 "Send implementation ID with NFSv4.1 exchange_id");
1500 MODULE_PARM_DESC(nfs4_unique_id, "nfs_client_id4 uniquifier string");
1502 module_param(recover_lost_locks, bool, 0644);
1503 MODULE_PARM_DESC(recover_lost_locks,
1504 "If the server reports that a lock might be lost, "
1505 "try to recover it risking data corruption.");
1508 #endif /* CONFIG_NFS_V4 */