aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2012-05-21 22:45:41 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-22 16:45:46 -0400
commitf092075dd33ea04000590e8ffea65c2e7d03d764 (patch)
tree626ce6b85084d50e9d2d81e32850e494eadbc8cb /fs/nfs/nfs4xdr.c
parent2c820d9a97f07b273b2c8a5960bd52b1b5864c68 (diff)
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>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index db040e971932..12b99825a1c1 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -53,9 +53,11 @@
53#include <linux/nfs4.h> 53#include <linux/nfs4.h>
54#include <linux/nfs_fs.h> 54#include <linux/nfs_fs.h>
55#include <linux/nfs_idmap.h> 55#include <linux/nfs_idmap.h>
56
56#include "nfs4_fs.h" 57#include "nfs4_fs.h"
57#include "internal.h" 58#include "internal.h"
58#include "pnfs.h" 59#include "pnfs.h"
60#include "netns.h"
59 61
60#define NFSDBG_FACILITY NFSDBG_XDR 62#define NFSDBG_FACILITY NFSDBG_XDR
61 63
@@ -1702,6 +1704,7 @@ static void encode_create_session(struct xdr_stream *xdr,
1702 char machine_name[NFS4_MAX_MACHINE_NAME_LEN]; 1704 char machine_name[NFS4_MAX_MACHINE_NAME_LEN];
1703 uint32_t len; 1705 uint32_t len;
1704 struct nfs_client *clp = args->client; 1706 struct nfs_client *clp = args->client;
1707 struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id);
1705 u32 max_resp_sz_cached; 1708 u32 max_resp_sz_cached;
1706 1709
1707 /* 1710 /*
@@ -1743,7 +1746,7 @@ static void encode_create_session(struct xdr_stream *xdr,
1743 *p++ = cpu_to_be32(RPC_AUTH_UNIX); /* auth_sys */ 1746 *p++ = cpu_to_be32(RPC_AUTH_UNIX); /* auth_sys */
1744 1747
1745 /* authsys_parms rfc1831 */ 1748 /* authsys_parms rfc1831 */
1746 *p++ = cpu_to_be32((u32)clp->cl_boot_time.tv_nsec); /* stamp */ 1749 *p++ = (__be32)nn->boot_time.tv_nsec; /* stamp */
1747 p = xdr_encode_opaque(p, machine_name, len); 1750 p = xdr_encode_opaque(p, machine_name, len);
1748 *p++ = cpu_to_be32(0); /* UID */ 1751 *p++ = cpu_to_be32(0); /* UID */
1749 *p++ = cpu_to_be32(0); /* GID */ 1752 *p++ = cpu_to_be32(0); /* GID */