nfs4state.c (2c6434888cef9e5f450d6c5b7df6d8c625ed27c1) nfs4state.c (b9efa1b27e25b1286504973c0a6bf0f24106faa8)
1/*
2 * fs/nfs/nfs4state.c
3 *
4 * Client-side XDR for NFSv4.
5 *
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
8 *

--- 1235 unchanged lines hidden (view full) ---

1244 }
1245 if (status == -NFS4ERR_MINOR_VERS_MISMATCH)
1246 status = -EPROTONOSUPPORT;
1247 }
1248 return status;
1249}
1250
1251#ifdef CONFIG_NFS_V4_1
1/*
2 * fs/nfs/nfs4state.c
3 *
4 * Client-side XDR for NFSv4.
5 *
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
8 *

--- 1235 unchanged lines hidden (view full) ---

1244 }
1245 if (status == -NFS4ERR_MINOR_VERS_MISMATCH)
1246 status = -EPROTONOSUPPORT;
1247 }
1248 return status;
1249}
1250
1251#ifdef CONFIG_NFS_V4_1
1252void nfs41_handle_recall_slot(struct nfs_client *clp)
1253{
1254 set_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state);
1255 nfs4_schedule_state_recovery(clp);
1256}
1257
1252void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags)
1253{
1254 if (!flags)
1255 return;
1256 else if (flags & SEQ4_STATUS_RESTART_RECLAIM_NEEDED) {
1257 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1258 nfs4_state_start_reclaim_reboot(clp);
1259 nfs4_schedule_state_recovery(clp);

--- 34 unchanged lines hidden (view full) ---

1294 */
1295 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) &&
1296 status == 0)
1297 nfs41_setup_state_renewal(clp);
1298
1299 return status;
1300}
1301
1258void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags)
1259{
1260 if (!flags)
1261 return;
1262 else if (flags & SEQ4_STATUS_RESTART_RECLAIM_NEEDED) {
1263 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1264 nfs4_state_start_reclaim_reboot(clp);
1265 nfs4_schedule_state_recovery(clp);

--- 34 unchanged lines hidden (view full) ---

1300 */
1301 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) &&
1302 status == 0)
1303 nfs41_setup_state_renewal(clp);
1304
1305 return status;
1306}
1307
1308static int nfs4_recall_slot(struct nfs_client *clp)
1309{
1310 struct nfs4_slot_table *fc_tbl = &clp->cl_session->fc_slot_table;
1311 struct nfs4_channel_attrs *fc_attrs = &clp->cl_session->fc_attrs;
1312 struct nfs4_slot *new, *old;
1313 int i;
1314
1315 nfs4_begin_drain_session(clp);
1316 new = kmalloc(fc_tbl->target_max_slots * sizeof(struct nfs4_slot),
1317 GFP_KERNEL);
1318 if (!new)
1319 return -ENOMEM;
1320
1321 spin_lock(&fc_tbl->slot_tbl_lock);
1322 for (i = 0; i < fc_tbl->target_max_slots; i++)
1323 new[i].seq_nr = fc_tbl->slots[i].seq_nr;
1324 old = fc_tbl->slots;
1325 fc_tbl->slots = new;
1326 fc_tbl->max_slots = fc_tbl->target_max_slots;
1327 fc_tbl->target_max_slots = 0;
1328 fc_attrs->max_reqs = fc_tbl->max_slots;
1329 spin_unlock(&fc_tbl->slot_tbl_lock);
1330
1331 kfree(old);
1332 nfs4_end_drain_session(clp);
1333 return 0;
1334}
1335
1302#else /* CONFIG_NFS_V4_1 */
1303static int nfs4_reset_session(struct nfs_client *clp) { return 0; }
1304static int nfs4_end_drain_session(struct nfs_client *clp) { return 0; }
1336#else /* CONFIG_NFS_V4_1 */
1337static int nfs4_reset_session(struct nfs_client *clp) { return 0; }
1338static int nfs4_end_drain_session(struct nfs_client *clp) { return 0; }
1339static int nfs4_recall_slot(struct nfs_client *clp) { return 0; }
1305#endif /* CONFIG_NFS_V4_1 */
1306
1307/* Set NFS4CLNT_LEASE_EXPIRED for all v4.0 errors and for recoverable errors
1308 * on EXCHANGE_ID for v4.1
1309 */
1310static void nfs4_set_lease_expired(struct nfs_client *clp, int status)
1311{
1312 if (nfs4_has_session(clp)) {

--- 80 unchanged lines hidden (view full) ---

1393 goto out_error;
1394 }
1395
1396 nfs4_end_drain_session(clp);
1397 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
1398 nfs_client_return_marked_delegations(clp);
1399 continue;
1400 }
1340#endif /* CONFIG_NFS_V4_1 */
1341
1342/* Set NFS4CLNT_LEASE_EXPIRED for all v4.0 errors and for recoverable errors
1343 * on EXCHANGE_ID for v4.1
1344 */
1345static void nfs4_set_lease_expired(struct nfs_client *clp, int status)
1346{
1347 if (nfs4_has_session(clp)) {

--- 80 unchanged lines hidden (view full) ---

1428 goto out_error;
1429 }
1430
1431 nfs4_end_drain_session(clp);
1432 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
1433 nfs_client_return_marked_delegations(clp);
1434 continue;
1435 }
1436 /* Recall session slots */
1437 if (test_and_clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state)
1438 && nfs4_has_session(clp)) {
1439 status = nfs4_recall_slot(clp);
1440 if (status < 0)
1441 goto out_error;
1442 continue;
1443 }
1401
1444
1445
1402 nfs4_clear_state_manager_bit(clp);
1403 /* Did we race with an attempt to give us more work? */
1404 if (clp->cl_state == 0)
1405 break;
1406 if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)
1407 break;
1408 }
1409 return;

--- 23 unchanged lines hidden ---
1446 nfs4_clear_state_manager_bit(clp);
1447 /* Did we race with an attempt to give us more work? */
1448 if (clp->cl_state == 0)
1449 break;
1450 if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)
1451 break;
1452 }
1453 return;

--- 23 unchanged lines hidden ---