History

NFSv4.1: Handle EXCHGID4_FLAG_CONFIRMED_R during NFSv4.1 migration

Transparent State Migration copies a client's lease state from the server where a filesystem used to reside to the server where it now resides. When an NFSv4.1 client first contacts that destination server, it uses EXCHANGE_ID to detect trunking relationships. The lease that was copied there is returned to that client, but the destination server sets EXCHGID4_FLAG_CONFIRMED_R when replying to the client. This is because the lease was confirmed on the source server (before it was copied). Normally, when CONFIRMED_R is set, a client purges the lease and creates a new one. However, that throws away the entire benefit of Transparent State Migration. Therefore, the client must not purge that lease when it is possible that Transparent State Migration has occurred.

Chuck Lever committed 9 years ago

Commit 8dcbec61 parent 1f541893 files · +18 −5Browse files

Unified · Split

3 files
  1. fs/nfs/nfs4client.c +5 −0
  2. fs/nfs/nfs4state.c +11 −5
  3. include/linux/nfs_fs_sb.h +2 −0
fs/nfs/nfs4client.c+5−0
@@ -414,6 +414,7 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp, · 413 unmodified lines
414 if (clp != old)414 if (clp != old)
415 clp->cl_preserve_clid = true;415 clp->cl_preserve_clid = true;
416 nfs_put_client(clp);416 nfs_put_client(clp);
417 clear_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags);
417 return old;418 return old;
418 419
419error:420error:
@@ -852,6 +853,8 @@ static int nfs4_set_client(struct nfs_server *server, · 432 unmodified lines
852 set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags);853 set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags);
853 if (server->options & NFS_OPTION_MIGRATION)854 if (server->options & NFS_OPTION_MIGRATION)
854 set_bit(NFS_CS_MIGRATION, &cl_init.init_flags);855 set_bit(NFS_CS_MIGRATION, &cl_init.init_flags);
856 if (test_bit(NFS_MIG_TSM_POSSIBLE, &server->mig_status))
857 set_bit(NFS_CS_TSM_POSSIBLE, &cl_init.init_flags);
855 858
856 /* Allocate or find a client reference we can use */859 /* Allocate or find a client reference we can use */
857 clp = nfs_get_client(&cl_init);860 clp = nfs_get_client(&cl_init);
@@ -1212,9 +1215,11 @@ int nfs4_update_server(struct nfs_server *server, const char *hostname, · 354 unmodified lines
1212 return -EAFNOSUPPORT;1215 return -EAFNOSUPPORT;
1213 1216
1214 nfs_server_remove_lists(server);1217 nfs_server_remove_lists(server);
1218 set_bit(NFS_MIG_TSM_POSSIBLE, &server->mig_status);
1215 error = nfs4_set_client(server, hostname, sap, salen, buf,1219 error = nfs4_set_client(server, hostname, sap, salen, buf,
1216 clp->cl_proto, clnt->cl_timeout,1220 clp->cl_proto, clnt->cl_timeout,
1217 clp->cl_minorversion, net);1221 clp->cl_minorversion, net);
1222 clear_bit(NFS_MIG_TSM_POSSIBLE, &server->mig_status);
1218 nfs_put_client(clp);1223 nfs_put_client(clp);
1219 if (error != 0) {1224 if (error != 0) {
1220 nfs_server_insert_lists(server);1225 nfs_server_insert_lists(server);
fs/nfs/nfs4state.c+11−5
@@ -352,11 +352,17 @@ int nfs41_discover_server_trunking(struct nfs_client *clp, · 351 unmodified lines
352 if (clp != *result)352 if (clp != *result)
353 return 0;353 return 0;
354 354
355 /* Purge state if the client id was established in a prior instance */355 /*
356 if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R)356 * Purge state if the client id was established in a prior
357 set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);357 * instance and the client id could not have arrived on the
358 else358 * server via Transparent State Migration.
359 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);359 */
360 if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R) {
361 if (!test_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags))
362 set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
363 else
364 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
365 }
360 nfs4_schedule_state_manager(clp);366 nfs4_schedule_state_manager(clp);
361 status = nfs_wait_client_init_complete(clp);367 status = nfs_wait_client_init_complete(clp);
362 if (status < 0)368 if (status < 0)
include/linux/nfs_fs_sb.h+2−0
@@ -42,6 +42,7 @@ struct nfs_client { · 41 unmodified lines
42#define NFS_CS_MIGRATION 2 /* - transparent state migr */42#define NFS_CS_MIGRATION 2 /* - transparent state migr */
43#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */43#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */
44#define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */44#define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */
45#define NFS_CS_TSM_POSSIBLE 5 /* - Maybe state migration */
45 struct sockaddr_storage cl_addr; /* server identifier */46 struct sockaddr_storage cl_addr; /* server identifier */
46 size_t cl_addrlen;47 size_t cl_addrlen;
47 char * cl_hostname; /* hostname of server */48 char * cl_hostname; /* hostname of server */
@@ -210,6 +211,7 @@ struct nfs_server { · 162 unmodified lines
210 unsigned long mig_status;211 unsigned long mig_status;
211#define NFS_MIG_IN_TRANSITION (1)212#define NFS_MIG_IN_TRANSITION (1)
212#define NFS_MIG_FAILED (2)213#define NFS_MIG_FAILED (2)
214#define NFS_MIG_TSM_POSSIBLE (3)
213 215
214 void (*destroy)(struct nfs_server *);216 void (*destroy)(struct nfs_server *);
215 217

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t