diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-03 16:01:51 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-03 16:01:51 -0500 |
commit | 0b08b07507d5ae733408fd4ebda1cd89d3a840ef (patch) | |
tree | c91d8b77610f640cd930f62407b9fc5fec283773 /fs/nfs/nfs4state.c | |
parent | 22763c5cf3690a681551162c15d34d935308c8d7 (diff) | |
parent | 1185a552e3d78807031f4021c5edb60d3e8838f1 (diff) |
Merge branch 'bugfixes' into nfs-for-next
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 2ef4fecf3984..62927879572f 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1046,20 +1046,19 @@ static void nfs4_state_start_reclaim_nograce(struct nfs_client *clp) | |||
1046 | nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce); | 1046 | nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce); |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | static void nfs4_state_end_reclaim_nograce(struct nfs_client *clp) | 1049 | static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) |
1050 | { | ||
1051 | clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); | ||
1052 | } | ||
1053 | |||
1054 | static void nfs4_recovery_handle_error(struct nfs_client *clp, int error) | ||
1055 | { | 1050 | { |
1056 | switch (error) { | 1051 | switch (error) { |
1057 | case -NFS4ERR_CB_PATH_DOWN: | 1052 | case -NFS4ERR_CB_PATH_DOWN: |
1058 | nfs_handle_cb_pathdown(clp); | 1053 | nfs_handle_cb_pathdown(clp); |
1059 | break; | 1054 | return 0; |
1055 | case -NFS4ERR_NO_GRACE: | ||
1056 | nfs4_state_end_reclaim_reboot(clp); | ||
1057 | return 0; | ||
1060 | case -NFS4ERR_STALE_CLIENTID: | 1058 | case -NFS4ERR_STALE_CLIENTID: |
1061 | case -NFS4ERR_LEASE_MOVED: | 1059 | case -NFS4ERR_LEASE_MOVED: |
1062 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); | 1060 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); |
1061 | nfs4_state_end_reclaim_reboot(clp); | ||
1063 | nfs4_state_start_reclaim_reboot(clp); | 1062 | nfs4_state_start_reclaim_reboot(clp); |
1064 | break; | 1063 | break; |
1065 | case -NFS4ERR_EXPIRED: | 1064 | case -NFS4ERR_EXPIRED: |
@@ -1074,6 +1073,7 @@ static void nfs4_recovery_handle_error(struct nfs_client *clp, int error) | |||
1074 | case -NFS4ERR_SEQ_MISORDERED: | 1073 | case -NFS4ERR_SEQ_MISORDERED: |
1075 | set_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state); | 1074 | set_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state); |
1076 | } | 1075 | } |
1076 | return error; | ||
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops) | 1079 | static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops) |
@@ -1093,8 +1093,7 @@ restart: | |||
1093 | if (status < 0) { | 1093 | if (status < 0) { |
1094 | set_bit(ops->owner_flag_bit, &sp->so_flags); | 1094 | set_bit(ops->owner_flag_bit, &sp->so_flags); |
1095 | nfs4_put_state_owner(sp); | 1095 | nfs4_put_state_owner(sp); |
1096 | nfs4_recovery_handle_error(clp, status); | 1096 | return nfs4_recovery_handle_error(clp, status); |
1097 | return status; | ||
1098 | } | 1097 | } |
1099 | nfs4_put_state_owner(sp); | 1098 | nfs4_put_state_owner(sp); |
1100 | goto restart; | 1099 | goto restart; |
@@ -1124,8 +1123,7 @@ static int nfs4_check_lease(struct nfs_client *clp) | |||
1124 | status = ops->renew_lease(clp, cred); | 1123 | status = ops->renew_lease(clp, cred); |
1125 | put_rpccred(cred); | 1124 | put_rpccred(cred); |
1126 | out: | 1125 | out: |
1127 | nfs4_recovery_handle_error(clp, status); | 1126 | return nfs4_recovery_handle_error(clp, status); |
1128 | return status; | ||
1129 | } | 1127 | } |
1130 | 1128 | ||
1131 | static int nfs4_reclaim_lease(struct nfs_client *clp) | 1129 | static int nfs4_reclaim_lease(struct nfs_client *clp) |
@@ -1234,7 +1232,8 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1234 | status = nfs4_reclaim_lease(clp); | 1232 | status = nfs4_reclaim_lease(clp); |
1235 | if (status) { | 1233 | if (status) { |
1236 | nfs4_set_lease_expired(clp, status); | 1234 | nfs4_set_lease_expired(clp, status); |
1237 | if (status == -EAGAIN) | 1235 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, |
1236 | &clp->cl_state)) | ||
1238 | continue; | 1237 | continue; |
1239 | if (clp->cl_cons_state == | 1238 | if (clp->cl_cons_state == |
1240 | NFS_CS_SESSION_INITING) | 1239 | NFS_CS_SESSION_INITING) |
@@ -1246,9 +1245,12 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1246 | 1245 | ||
1247 | if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) { | 1246 | if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) { |
1248 | status = nfs4_check_lease(clp); | 1247 | status = nfs4_check_lease(clp); |
1249 | if (status != 0) | 1248 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) |
1250 | continue; | 1249 | continue; |
1250 | if (status < 0 && status != -NFS4ERR_CB_PATH_DOWN) | ||
1251 | goto out_error; | ||
1251 | } | 1252 | } |
1253 | |||
1252 | /* Initialize or reset the session */ | 1254 | /* Initialize or reset the session */ |
1253 | if (test_and_clear_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state) | 1255 | if (test_and_clear_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state) |
1254 | && nfs4_has_session(clp)) { | 1256 | && nfs4_has_session(clp)) { |
@@ -1256,41 +1258,36 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1256 | status = nfs4_initialize_session(clp); | 1258 | status = nfs4_initialize_session(clp); |
1257 | else | 1259 | else |
1258 | status = nfs4_reset_session(clp); | 1260 | status = nfs4_reset_session(clp); |
1259 | if (status) { | 1261 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) |
1260 | if (status == -NFS4ERR_STALE_CLIENTID) | 1262 | continue; |
1261 | continue; | 1263 | if (status < 0) |
1262 | goto out_error; | 1264 | goto out_error; |
1263 | } | ||
1264 | } | 1265 | } |
1266 | |||
1265 | /* First recover reboot state... */ | 1267 | /* First recover reboot state... */ |
1266 | if (test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { | 1268 | if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { |
1267 | status = nfs4_do_reclaim(clp, | 1269 | status = nfs4_do_reclaim(clp, |
1268 | nfs4_reboot_recovery_ops[clp->cl_minorversion]); | 1270 | nfs4_reboot_recovery_ops[clp->cl_minorversion]); |
1269 | if (status == -NFS4ERR_STALE_CLIENTID) | 1271 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) || |
1270 | continue; | 1272 | test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) |
1271 | if (test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) | ||
1272 | continue; | 1273 | continue; |
1273 | nfs4_state_end_reclaim_reboot(clp); | 1274 | nfs4_state_end_reclaim_reboot(clp); |
1274 | continue; | 1275 | if (test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) |
1276 | continue; | ||
1277 | if (status < 0) | ||
1278 | goto out_error; | ||
1275 | } | 1279 | } |
1276 | 1280 | ||
1277 | /* Now recover expired state... */ | 1281 | /* Now recover expired state... */ |
1278 | if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) { | 1282 | if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) { |
1279 | status = nfs4_do_reclaim(clp, | 1283 | status = nfs4_do_reclaim(clp, |
1280 | nfs4_nograce_recovery_ops[clp->cl_minorversion]); | 1284 | nfs4_nograce_recovery_ops[clp->cl_minorversion]); |
1281 | if (status < 0) { | 1285 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) || |
1282 | set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); | 1286 | test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state) || |
1283 | if (status == -NFS4ERR_STALE_CLIENTID) | 1287 | test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) |
1284 | continue; | 1288 | continue; |
1285 | if (status == -NFS4ERR_EXPIRED) | 1289 | if (status < 0) |
1286 | continue; | ||
1287 | if (test_bit(NFS4CLNT_SESSION_SETUP, | ||
1288 | &clp->cl_state)) | ||
1289 | continue; | ||
1290 | goto out_error; | 1290 | goto out_error; |
1291 | } else | ||
1292 | nfs4_state_end_reclaim_nograce(clp); | ||
1293 | continue; | ||
1294 | } | 1291 | } |
1295 | 1292 | ||
1296 | if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) { | 1293 | if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) { |
@@ -1309,8 +1306,6 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1309 | out_error: | 1306 | out_error: |
1310 | printk(KERN_WARNING "Error: state manager failed on NFSv4 server %s" | 1307 | printk(KERN_WARNING "Error: state manager failed on NFSv4 server %s" |
1311 | " with error %d\n", clp->cl_hostname, -status); | 1308 | " with error %d\n", clp->cl_hostname, -status); |
1312 | if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) | ||
1313 | nfs4_state_end_reclaim_reboot(clp); | ||
1314 | nfs4_clear_state_manager_bit(clp); | 1309 | nfs4_clear_state_manager_bit(clp); |
1315 | } | 1310 | } |
1316 | 1311 | ||