| 
									
										
											  
											
												NFS: Always use the same SETCLIENTID boot verifier
Currently our NFS client assigns a unique SETCLIENTID boot verifier
for each server IP address it knows about.  It's set to CURRENT_TIME
when the struct nfs_client for that server IP is created.
During the SETCLIENTID operation, our client also presents an
nfs_client_id4 string to servers, as an identifier on which the server
can hang all of this client's NFSv4 state.  Our client's
nfs_client_id4 string is unique for each server IP address.
An NFSv4 server is obligated to wipe all NFSv4 state associated with
an nfs_client_id4 string when the client presents the same
nfs_client_id4 string along with a changed SETCLIENTID boot verifier.
When our client unmounts the last of a server's shares, it destroys
that server's struct nfs_client.  The next time the client mounts that
NFS server, it creates a fresh struct nfs_client with a fresh boot
verifier.  On seeing the fresh verifer, the server wipes any previous
NFSv4 state associated with that nfs_client_id4.
However, NFSv4.1 clients are supposed to present the same
nfs_client_id4 string to all servers.  And, to support Transparent
State Migration, the same nfs_client_id4 string should be presented
to all NFSv4.0 servers so they recognize that migrated state for this
client belongs with state a server may already have for this client.
(This is known as the Uniform Client String model).
If the nfs_client_id4 string is the same but the boot verifier changes
for each server IP address, SETCLIENTID and EXCHANGE_ID operations
from such a client could unintentionally result in a server wiping a
client's previously obtained lease.
Thus, if our NFS client is going to use a fixed nfs_client_id4 string,
either for NFSv4.0 or NFSv4.1 mounts, our NFS client should use a
boot verifier that does not change depending on server IP address.
Replace our current per-nfs_client boot verifier with a per-nfs_net
boot verifier.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
											
										 
											2012-05-21 22:45:41 -04:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * NFS-private data for each "struct net".  Accessed with net_generic(). | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-25 17:13:04 +03:00
										 |  |  | #ifndef __NFS_NETNS_H__
 | 
					
						
							|  |  |  | #define __NFS_NETNS_H__
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-02 14:18:54 +04:00
										 |  |  | #include <linux/nfs4.h>
 | 
					
						
							| 
									
										
										
										
											2011-11-25 17:13:04 +03:00
										 |  |  | #include <net/net_namespace.h>
 | 
					
						
							|  |  |  | #include <net/netns/generic.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-11 18:20:23 +04:00
										 |  |  | struct bl_dev_msg { | 
					
						
							|  |  |  | 	int32_t status; | 
					
						
							|  |  |  | 	uint32_t major, minor; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-25 17:13:04 +03:00
										 |  |  | struct nfs_net { | 
					
						
							|  |  |  | 	struct cache_detail *nfs_dns_resolve; | 
					
						
							| 
									
										
										
										
											2012-01-10 17:04:24 +04:00
										 |  |  | 	struct rpc_pipe *bl_device_pipe; | 
					
						
							| 
									
										
										
										
											2012-03-11 18:20:23 +04:00
										 |  |  | 	struct bl_dev_msg bl_mount_reply; | 
					
						
							| 
									
										
										
										
											2012-03-11 18:20:31 +04:00
										 |  |  | 	wait_queue_head_t bl_wq; | 
					
						
							| 
									
										
										
										
											2012-01-23 17:26:05 +00:00
										 |  |  | 	struct list_head nfs_client_list; | 
					
						
							| 
									
										
										
										
											2012-01-23 17:26:14 +00:00
										 |  |  | 	struct list_head nfs_volume_list; | 
					
						
							| 
									
										
										
										
											2012-07-30 16:05:25 -04:00
										 |  |  | #if IS_ENABLED(CONFIG_NFS_V4)
 | 
					
						
							| 
									
										
										
										
											2012-01-23 17:26:22 +00:00
										 |  |  | 	struct idr cb_ident_idr; /* Protected by nfs_client_lock */ | 
					
						
							| 
									
										
										
										
											2012-08-20 18:00:36 +04:00
										 |  |  | 	unsigned short nfs_callback_tcpport; | 
					
						
							| 
									
										
										
										
											2012-08-20 18:00:41 +04:00
										 |  |  | 	unsigned short nfs_callback_tcpport6; | 
					
						
							| 
									
										
										
										
											2012-08-20 18:00:46 +04:00
										 |  |  | 	int cb_users[NFS4_MAX_MINOR_VERSION + 1]; | 
					
						
							| 
									
										
										
										
											2012-01-23 17:26:22 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2012-01-23 17:26:31 +00:00
										 |  |  | 	spinlock_t nfs_client_lock; | 
					
						
							| 
									
										
											  
											
												NFS: Always use the same SETCLIENTID boot verifier
Currently our NFS client assigns a unique SETCLIENTID boot verifier
for each server IP address it knows about.  It's set to CURRENT_TIME
when the struct nfs_client for that server IP is created.
During the SETCLIENTID operation, our client also presents an
nfs_client_id4 string to servers, as an identifier on which the server
can hang all of this client's NFSv4 state.  Our client's
nfs_client_id4 string is unique for each server IP address.
An NFSv4 server is obligated to wipe all NFSv4 state associated with
an nfs_client_id4 string when the client presents the same
nfs_client_id4 string along with a changed SETCLIENTID boot verifier.
When our client unmounts the last of a server's shares, it destroys
that server's struct nfs_client.  The next time the client mounts that
NFS server, it creates a fresh struct nfs_client with a fresh boot
verifier.  On seeing the fresh verifer, the server wipes any previous
NFSv4 state associated with that nfs_client_id4.
However, NFSv4.1 clients are supposed to present the same
nfs_client_id4 string to all servers.  And, to support Transparent
State Migration, the same nfs_client_id4 string should be presented
to all NFSv4.0 servers so they recognize that migrated state for this
client belongs with state a server may already have for this client.
(This is known as the Uniform Client String model).
If the nfs_client_id4 string is the same but the boot verifier changes
for each server IP address, SETCLIENTID and EXCHANGE_ID operations
from such a client could unintentionally result in a server wiping a
client's previously obtained lease.
Thus, if our NFS client is going to use a fixed nfs_client_id4 string,
either for NFSv4.0 or NFSv4.1 mounts, our NFS client should use a
boot verifier that does not change depending on server IP address.
Replace our current per-nfs_client boot verifier with a per-nfs_net
boot verifier.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
											
										 
											2012-05-21 22:45:41 -04:00
										 |  |  | 	struct timespec boot_time; | 
					
						
							| 
									
										
										
										
											2011-11-25 17:13:04 +03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern int nfs_net_id; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |