diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-23 13:23:31 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-23 15:20:57 -0400 |
commit | 7b38c3682c5cab4f98751d5fe57b78a59020653d (patch) | |
tree | c6c2ea72b99b59b60a3c7ba3d142a4926664398e /fs/nfs/nfs4filelayoutdev.c | |
parent | acdeb69d9c5934a678a732b4e24770326bf9471e (diff) |
NFSv4.1: Fix session initialisation races
Session initialisation is not complete until the lease manager
has run. We need to ensure that both nfs4_init_session and
nfs4_init_ds_session do so, and that they check for any resulting
errors in clp->cl_cons_state.
Only after this is done, can nfs4_ds_connect check the contents
of clp->cl_exchange_flags.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Andy Adamson <andros@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4filelayoutdev.c')
-rw-r--r-- | fs/nfs/nfs4filelayoutdev.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index c610f84ff030..a1fab8da7f03 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
@@ -203,28 +203,7 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds) | |||
203 | goto out; | 203 | goto out; |
204 | } | 204 | } |
205 | 205 | ||
206 | if ((clp->cl_exchange_flags & EXCHGID4_FLAG_MASK_PNFS) != 0) { | 206 | status = nfs4_init_ds_session(clp, mds_srv->nfs_client->cl_lease_time); |
207 | if (!is_ds_client(clp)) { | ||
208 | status = -ENODEV; | ||
209 | goto out_put; | ||
210 | } | ||
211 | ds->ds_clp = clp; | ||
212 | dprintk("%s [existing] server=%s\n", __func__, | ||
213 | ds->ds_remotestr); | ||
214 | goto out; | ||
215 | } | ||
216 | |||
217 | /* | ||
218 | * Do not set NFS_CS_CHECK_LEASE_TIME instead set the DS lease to | ||
219 | * be equal to the MDS lease. Renewal is scheduled in create_session. | ||
220 | */ | ||
221 | spin_lock(&mds_srv->nfs_client->cl_lock); | ||
222 | clp->cl_lease_time = mds_srv->nfs_client->cl_lease_time; | ||
223 | spin_unlock(&mds_srv->nfs_client->cl_lock); | ||
224 | clp->cl_last_renewal = jiffies; | ||
225 | |||
226 | /* New nfs_client */ | ||
227 | status = nfs4_init_ds_session(clp); | ||
228 | if (status) | 207 | if (status) |
229 | goto out_put; | 208 | goto out_put; |
230 | 209 | ||