Commit d3b4c9d76738df49a7db7682c2518a0ef9f7391d

Authored by Andy Adamson
Committed by Trond Myklebust
1 parent 89d1ea6579

NFSv4.1: new flag for state renewal check

Data servers not sharing a session with the mount MDS always have an empty
cl_superblocks list.
Replace the cl_superblocks empty list check to see if it is time to shut down
renewd with the NFS_CS_STOP_RENEW bit which is not set by such a data server.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 3 changed files with 7 additions and 5 deletions Side-by-side Diff

... ... @@ -1019,14 +1019,19 @@
1019 1019 spin_lock(&nfs_client_lock);
1020 1020 list_add_tail_rcu(&server->client_link, &clp->cl_superblocks);
1021 1021 list_add_tail(&server->master_link, &nfs_volume_list);
  1022 + clear_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state);
1022 1023 spin_unlock(&nfs_client_lock);
1023 1024  
1024 1025 }
1025 1026  
1026 1027 static void nfs_server_remove_lists(struct nfs_server *server)
1027 1028 {
  1029 + struct nfs_client *clp = server->nfs_client;
  1030 +
1028 1031 spin_lock(&nfs_client_lock);
1029 1032 list_del_rcu(&server->client_link);
  1033 + if (clp && list_empty(&clp->cl_superblocks))
  1034 + set_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state);
1030 1035 list_del(&server->master_link);
1031 1036 spin_unlock(&nfs_client_lock);
1032 1037  
... ... @@ -64,12 +64,8 @@
64 64 ops = clp->cl_mvops->state_renewal_ops;
65 65 dprintk("%s: start\n", __func__);
66 66  
67   - rcu_read_lock();
68   - if (list_empty(&clp->cl_superblocks)) {
69   - rcu_read_unlock();
  67 + if (test_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state))
70 68 goto out;
71   - }
72   - rcu_read_unlock();
73 69  
74 70 spin_lock(&clp->cl_lock);
75 71 lease = clp->cl_lease_time;
include/linux/nfs_fs_sb.h
... ... @@ -30,6 +30,7 @@
30 30 #define NFS_CS_CALLBACK 1 /* - callback started */
31 31 #define NFS_CS_IDMAP 2 /* - idmap started */
32 32 #define NFS_CS_RENEWD 3 /* - renewd started */
  33 +#define NFS_CS_STOP_RENEW 4 /* no more state to renew */
33 34 struct sockaddr_storage cl_addr; /* server identifier */
34 35 size_t cl_addrlen;
35 36 char * cl_hostname; /* hostname of server */