diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-15 17:36:57 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-15 17:36:57 -0500 |
commit | 380454126f1357db9270f9d1ca05dfe1a6e4ad47 (patch) | |
tree | b7a7afdb59c0421f371c7242c170982153a76835 /fs | |
parent | 72211dbe727f7c1451aa5adfcbd1197b090eb276 (diff) |
NFSv4: Fix a regression in the NFSv4 state manager
Commit 5601a00d671fe89f9b087513244abcd08ad67e7d (nfs: run state manager
in privileged mode) introduces a regression in the NFSv4 code when
compiled with CONFIG_NFS_V4_1. The calls to nfs4_end_drain_session()
from the main loop in nfs4_state_manager() Oops due to the lack of an
NFSv4.1 session when running NFSv4.0.
The fix is to move those two calls back into nfs41_init_clientid() and
nfs4_reset_session().
The calls to nfs4_end_drain_session() that remain inside
nfs4_state_manager() are safe, since the NFSv4.0 code will never set the
NFS4CLNT_SESSION_DRAINING bit.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4state.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 18e8b26878c5..6d263ed79e92 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -176,6 +176,7 @@ int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) | |||
176 | { | 176 | { |
177 | int status; | 177 | int status; |
178 | 178 | ||
179 | nfs4_begin_drain_session(clp); | ||
179 | status = nfs4_proc_exchange_id(clp, cred); | 180 | status = nfs4_proc_exchange_id(clp, cred); |
180 | if (status != 0) | 181 | if (status != 0) |
181 | goto out; | 182 | goto out; |
@@ -1274,6 +1275,7 @@ static int nfs4_reset_session(struct nfs_client *clp) | |||
1274 | { | 1275 | { |
1275 | int status; | 1276 | int status; |
1276 | 1277 | ||
1278 | nfs4_begin_drain_session(clp); | ||
1277 | status = nfs4_proc_destroy_session(clp->cl_session); | 1279 | status = nfs4_proc_destroy_session(clp->cl_session); |
1278 | if (status && status != -NFS4ERR_BADSESSION && | 1280 | if (status && status != -NFS4ERR_BADSESSION && |
1279 | status != -NFS4ERR_DEADSESSION) { | 1281 | status != -NFS4ERR_DEADSESSION) { |
@@ -1299,7 +1301,6 @@ out: | |||
1299 | 1301 | ||
1300 | #else /* CONFIG_NFS_V4_1 */ | 1302 | #else /* CONFIG_NFS_V4_1 */ |
1301 | static int nfs4_reset_session(struct nfs_client *clp) { return 0; } | 1303 | static int nfs4_reset_session(struct nfs_client *clp) { return 0; } |
1302 | static int nfs4_begin_drain_session(struct nfs_client *clp) { return 0; } | ||
1303 | static int nfs4_end_drain_session(struct nfs_client *clp) { return 0; } | 1304 | static int nfs4_end_drain_session(struct nfs_client *clp) { return 0; } |
1304 | #endif /* CONFIG_NFS_V4_1 */ | 1305 | #endif /* CONFIG_NFS_V4_1 */ |
1305 | 1306 | ||
@@ -1332,7 +1333,6 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1332 | for(;;) { | 1333 | for(;;) { |
1333 | if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) { | 1334 | if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) { |
1334 | /* We're going to have to re-establish a clientid */ | 1335 | /* We're going to have to re-establish a clientid */ |
1335 | nfs4_begin_drain_session(clp); | ||
1336 | status = nfs4_reclaim_lease(clp); | 1336 | status = nfs4_reclaim_lease(clp); |
1337 | if (status) { | 1337 | if (status) { |
1338 | nfs4_set_lease_expired(clp, status); | 1338 | nfs4_set_lease_expired(clp, status); |
@@ -1359,7 +1359,6 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1359 | /* Initialize or reset the session */ | 1359 | /* Initialize or reset the session */ |
1360 | if (test_and_clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) | 1360 | if (test_and_clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) |
1361 | && nfs4_has_session(clp)) { | 1361 | && nfs4_has_session(clp)) { |
1362 | nfs4_begin_drain_session(clp); | ||
1363 | status = nfs4_reset_session(clp); | 1362 | status = nfs4_reset_session(clp); |
1364 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) | 1363 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) |
1365 | continue; | 1364 | continue; |