diff options
| -rw-r--r-- | Documentation/filesystems/nfs/nfs.txt | 44 | ||||
| -rw-r--r-- | Documentation/kernel-parameters.txt | 5 | ||||
| -rw-r--r-- | fs/nfs/nfs4_fs.h | 3 | ||||
| -rw-r--r-- | fs/nfs/nfs4proc.c | 6 | ||||
| -rw-r--r-- | fs/nfs/super.c | 5 |
5 files changed, 59 insertions, 4 deletions
diff --git a/Documentation/filesystems/nfs/nfs.txt b/Documentation/filesystems/nfs/nfs.txt index f50f26ce6cd0..f2571c8bef74 100644 --- a/Documentation/filesystems/nfs/nfs.txt +++ b/Documentation/filesystems/nfs/nfs.txt | |||
| @@ -12,9 +12,47 @@ and work is in progress on adding support for minor version 1 of the NFSv4 | |||
| 12 | protocol. | 12 | protocol. |
| 13 | 13 | ||
| 14 | The purpose of this document is to provide information on some of the | 14 | The purpose of this document is to provide information on some of the |
| 15 | upcall interfaces that are used in order to provide the NFS client with | 15 | special features of the NFS client that can be configured by system |
| 16 | some of the information that it requires in order to fully comply with | 16 | administrators. |
| 17 | the NFS spec. | 17 | |
| 18 | |||
| 19 | The nfs4_unique_id parameter | ||
| 20 | ============================ | ||
| 21 | |||
| 22 | NFSv4 requires clients to identify themselves to servers with a unique | ||
| 23 | string. File open and lock state shared between one client and one server | ||
| 24 | is associated with this identity. To support robust NFSv4 state recovery | ||
| 25 | and transparent state migration, this identity string must not change | ||
| 26 | across client reboots. | ||
| 27 | |||
| 28 | Without any other intervention, the Linux client uses a string that contains | ||
| 29 | the local system's node name. System administrators, however, often do not | ||
| 30 | take care to ensure that node names are fully qualified and do not change | ||
| 31 | over the lifetime of a client system. Node names can have other | ||
| 32 | administrative requirements that require particular behavior that does not | ||
| 33 | work well as part of an nfs_client_id4 string. | ||
| 34 | |||
| 35 | The nfs.nfs4_unique_id boot parameter specifies a unique string that can be | ||
| 36 | used instead of a system's node name when an NFS client identifies itself to | ||
| 37 | a server. Thus, if the system's node name is not unique, or it changes, its | ||
| 38 | nfs.nfs4_unique_id stays the same, preventing collision with other clients | ||
| 39 | or loss of state during NFS reboot recovery or transparent state migration. | ||
| 40 | |||
| 41 | The nfs.nfs4_unique_id string is typically a UUID, though it can contain | ||
| 42 | anything that is believed to be unique across all NFS clients. An | ||
| 43 | nfs4_unique_id string should be chosen when a client system is installed, | ||
| 44 | just as a system's root file system gets a fresh UUID in its label at | ||
| 45 | install time. | ||
| 46 | |||
| 47 | The string should remain fixed for the lifetime of the client. It can be | ||
| 48 | changed safely if care is taken that the client shuts down cleanly and all | ||
| 49 | outstanding NFSv4 state has expired, to prevent loss of NFSv4 state. | ||
| 50 | |||
| 51 | This string can be stored in an NFS client's grub.conf, or it can be provided | ||
| 52 | via a net boot facility such as PXE. It may also be specified as an nfs.ko | ||
| 53 | module parameter. Specifying a uniquifier string is not support for NFS | ||
| 54 | clients running in containers. | ||
| 55 | |||
| 18 | 56 | ||
| 19 | The DNS resolver | 57 | The DNS resolver |
| 20 | ================ | 58 | ================ |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index ad7e2e5088c1..396a1e66e0ae 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -1719,6 +1719,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 1719 | will be autodetected by the client, and it will fall | 1719 | will be autodetected by the client, and it will fall |
| 1720 | back to using the idmapper. | 1720 | back to using the idmapper. |
| 1721 | To turn off this behaviour, set the value to '0'. | 1721 | To turn off this behaviour, set the value to '0'. |
| 1722 | nfs.nfs4_unique_id= | ||
| 1723 | [NFS4] Specify an additional fixed unique ident- | ||
| 1724 | ification string that NFSv4 clients can insert into | ||
| 1725 | their nfs_client_id4 string. This is typically a | ||
| 1726 | UUID that is generated at system install time. | ||
| 1722 | 1727 | ||
| 1723 | nfs.send_implementation_id = | 1728 | nfs.send_implementation_id = |
| 1724 | [NFSv4.1] Send client implementation identification | 1729 | [NFSv4.1] Send client implementation identification |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 832503c7a00e..a525fdefccde 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
| @@ -380,6 +380,9 @@ extern bool nfs4_disable_idmapping; | |||
| 380 | extern unsigned short max_session_slots; | 380 | extern unsigned short max_session_slots; |
| 381 | extern unsigned short send_implementation_id; | 381 | extern unsigned short send_implementation_id; |
| 382 | 382 | ||
| 383 | #define NFS4_CLIENT_ID_UNIQ_LEN (64) | ||
| 384 | extern char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN]; | ||
| 385 | |||
| 383 | /* nfs4sysctl.c */ | 386 | /* nfs4sysctl.c */ |
| 384 | #ifdef CONFIG_SYSCTL | 387 | #ifdef CONFIG_SYSCTL |
| 385 | int nfs4_register_sysctl(void); | 388 | int nfs4_register_sysctl(void); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b5834abfcbff..9aa97112426f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -4068,9 +4068,13 @@ static unsigned int | |||
| 4068 | nfs4_init_uniform_client_string(const struct nfs_client *clp, | 4068 | nfs4_init_uniform_client_string(const struct nfs_client *clp, |
| 4069 | char *buf, size_t len) | 4069 | char *buf, size_t len) |
| 4070 | { | 4070 | { |
| 4071 | char *nodename = clp->cl_rpcclient->cl_nodename; | ||
| 4072 | |||
| 4073 | if (nfs4_client_id_uniquifier[0] != '\0') | ||
| 4074 | nodename = nfs4_client_id_uniquifier; | ||
| 4071 | return scnprintf(buf, len, "Linux NFSv%u.%u %s", | 4075 | return scnprintf(buf, len, "Linux NFSv%u.%u %s", |
| 4072 | clp->rpc_ops->version, clp->cl_minorversion, | 4076 | clp->rpc_ops->version, clp->cl_minorversion, |
| 4073 | clp->cl_rpcclient->cl_nodename); | 4077 | nodename); |
| 4074 | } | 4078 | } |
| 4075 | 4079 | ||
| 4076 | /** | 4080 | /** |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 056138d45c11..56f02a9bd6d3 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -2662,6 +2662,7 @@ unsigned int nfs_idmap_cache_timeout = 600; | |||
| 2662 | bool nfs4_disable_idmapping = true; | 2662 | bool nfs4_disable_idmapping = true; |
| 2663 | unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE; | 2663 | unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE; |
| 2664 | unsigned short send_implementation_id = 1; | 2664 | unsigned short send_implementation_id = 1; |
| 2665 | char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN] = ""; | ||
| 2665 | 2666 | ||
| 2666 | EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport); | 2667 | EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport); |
| 2667 | EXPORT_SYMBOL_GPL(nfs_callback_tcpport); | 2668 | EXPORT_SYMBOL_GPL(nfs_callback_tcpport); |
| @@ -2669,6 +2670,7 @@ EXPORT_SYMBOL_GPL(nfs_idmap_cache_timeout); | |||
| 2669 | EXPORT_SYMBOL_GPL(nfs4_disable_idmapping); | 2670 | EXPORT_SYMBOL_GPL(nfs4_disable_idmapping); |
| 2670 | EXPORT_SYMBOL_GPL(max_session_slots); | 2671 | EXPORT_SYMBOL_GPL(max_session_slots); |
| 2671 | EXPORT_SYMBOL_GPL(send_implementation_id); | 2672 | EXPORT_SYMBOL_GPL(send_implementation_id); |
| 2673 | EXPORT_SYMBOL_GPL(nfs4_client_id_uniquifier); | ||
| 2672 | 2674 | ||
| 2673 | #define NFS_CALLBACK_MAXPORTNR (65535U) | 2675 | #define NFS_CALLBACK_MAXPORTNR (65535U) |
| 2674 | 2676 | ||
| @@ -2694,6 +2696,8 @@ static struct kernel_param_ops param_ops_portnr = { | |||
| 2694 | module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644); | 2696 | module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644); |
| 2695 | module_param(nfs_idmap_cache_timeout, int, 0644); | 2697 | module_param(nfs_idmap_cache_timeout, int, 0644); |
| 2696 | module_param(nfs4_disable_idmapping, bool, 0644); | 2698 | module_param(nfs4_disable_idmapping, bool, 0644); |
| 2699 | module_param_string(nfs4_unique_id, nfs4_client_id_uniquifier, | ||
| 2700 | NFS4_CLIENT_ID_UNIQ_LEN, 0600); | ||
| 2697 | MODULE_PARM_DESC(nfs4_disable_idmapping, | 2701 | MODULE_PARM_DESC(nfs4_disable_idmapping, |
| 2698 | "Turn off NFSv4 idmapping when using 'sec=sys'"); | 2702 | "Turn off NFSv4 idmapping when using 'sec=sys'"); |
| 2699 | module_param(max_session_slots, ushort, 0644); | 2703 | module_param(max_session_slots, ushort, 0644); |
| @@ -2702,6 +2706,7 @@ MODULE_PARM_DESC(max_session_slots, "Maximum number of outstanding NFSv4.1 " | |||
| 2702 | module_param(send_implementation_id, ushort, 0644); | 2706 | module_param(send_implementation_id, ushort, 0644); |
| 2703 | MODULE_PARM_DESC(send_implementation_id, | 2707 | MODULE_PARM_DESC(send_implementation_id, |
| 2704 | "Send implementation ID with NFSv4.1 exchange_id"); | 2708 | "Send implementation ID with NFSv4.1 exchange_id"); |
| 2709 | MODULE_PARM_DESC(nfs4_unique_id, "nfs_client_id4 uniquifier string"); | ||
| 2705 | MODULE_ALIAS("nfs4"); | 2710 | MODULE_ALIAS("nfs4"); |
| 2706 | 2711 | ||
| 2707 | #endif /* CONFIG_NFS_V4 */ | 2712 | #endif /* CONFIG_NFS_V4 */ |
