diff options
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 1fab140764c4..e22862f13564 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -228,19 +228,8 @@ static int nfs41_setup_state_renewal(struct nfs_client *clp) | |||
228 | return status; | 228 | return status; |
229 | } | 229 | } |
230 | 230 | ||
231 | /* | 231 | static void nfs4_end_drain_slot_table(struct nfs4_slot_table *tbl) |
232 | * Back channel returns NFS4ERR_DELAY for new requests when | ||
233 | * NFS4_SESSION_DRAINING is set so there is no work to be done when draining | ||
234 | * is ended. | ||
235 | */ | ||
236 | static void nfs4_end_drain_session(struct nfs_client *clp) | ||
237 | { | 232 | { |
238 | struct nfs4_session *ses = clp->cl_session; | ||
239 | struct nfs4_slot_table *tbl; | ||
240 | |||
241 | if (ses == NULL) | ||
242 | return; | ||
243 | tbl = &ses->fc_slot_table; | ||
244 | if (test_and_clear_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) { | 233 | if (test_and_clear_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) { |
245 | spin_lock(&tbl->slot_tbl_lock); | 234 | spin_lock(&tbl->slot_tbl_lock); |
246 | nfs41_wake_slot_table(tbl); | 235 | nfs41_wake_slot_table(tbl); |
@@ -248,6 +237,16 @@ static void nfs4_end_drain_session(struct nfs_client *clp) | |||
248 | } | 237 | } |
249 | } | 238 | } |
250 | 239 | ||
240 | static void nfs4_end_drain_session(struct nfs_client *clp) | ||
241 | { | ||
242 | struct nfs4_session *ses = clp->cl_session; | ||
243 | |||
244 | if (ses != NULL) { | ||
245 | nfs4_end_drain_slot_table(&ses->bc_slot_table); | ||
246 | nfs4_end_drain_slot_table(&ses->fc_slot_table); | ||
247 | } | ||
248 | } | ||
249 | |||
251 | /* | 250 | /* |
252 | * Signal state manager thread if session fore channel is drained | 251 | * Signal state manager thread if session fore channel is drained |
253 | */ | 252 | */ |
@@ -1194,7 +1193,7 @@ void nfs4_schedule_state_manager(struct nfs_client *clp) | |||
1194 | snprintf(buf, sizeof(buf), "%s-manager", | 1193 | snprintf(buf, sizeof(buf), "%s-manager", |
1195 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)); | 1194 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)); |
1196 | rcu_read_unlock(); | 1195 | rcu_read_unlock(); |
1197 | task = kthread_run(nfs4_run_state_manager, clp, buf); | 1196 | task = kthread_run(nfs4_run_state_manager, clp, "%s", buf); |
1198 | if (IS_ERR(task)) { | 1197 | if (IS_ERR(task)) { |
1199 | printk(KERN_ERR "%s: kthread_run: %ld\n", | 1198 | printk(KERN_ERR "%s: kthread_run: %ld\n", |
1200 | __func__, PTR_ERR(task)); | 1199 | __func__, PTR_ERR(task)); |
@@ -1373,13 +1372,13 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_ | |||
1373 | /* Guard against delegation returns and new lock/unlock calls */ | 1372 | /* Guard against delegation returns and new lock/unlock calls */ |
1374 | down_write(&nfsi->rwsem); | 1373 | down_write(&nfsi->rwsem); |
1375 | /* Protect inode->i_flock using the BKL */ | 1374 | /* Protect inode->i_flock using the BKL */ |
1376 | lock_flocks(); | 1375 | spin_lock(&inode->i_lock); |
1377 | for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { | 1376 | for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { |
1378 | if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) | 1377 | if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) |
1379 | continue; | 1378 | continue; |
1380 | if (nfs_file_open_context(fl->fl_file)->state != state) | 1379 | if (nfs_file_open_context(fl->fl_file)->state != state) |
1381 | continue; | 1380 | continue; |
1382 | unlock_flocks(); | 1381 | spin_unlock(&inode->i_lock); |
1383 | status = ops->recover_lock(state, fl); | 1382 | status = ops->recover_lock(state, fl); |
1384 | switch (status) { | 1383 | switch (status) { |
1385 | case 0: | 1384 | case 0: |
@@ -1406,9 +1405,9 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_ | |||
1406 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ | 1405 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ |
1407 | status = 0; | 1406 | status = 0; |
1408 | } | 1407 | } |
1409 | lock_flocks(); | 1408 | spin_lock(&inode->i_lock); |
1410 | } | 1409 | } |
1411 | unlock_flocks(); | 1410 | spin_unlock(&inode->i_lock); |
1412 | out: | 1411 | out: |
1413 | up_write(&nfsi->rwsem); | 1412 | up_write(&nfsi->rwsem); |
1414 | return status; | 1413 | return status; |
@@ -1563,11 +1562,12 @@ static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp) | |||
1563 | } | 1562 | } |
1564 | 1563 | ||
1565 | static void nfs4_reclaim_complete(struct nfs_client *clp, | 1564 | static void nfs4_reclaim_complete(struct nfs_client *clp, |
1566 | const struct nfs4_state_recovery_ops *ops) | 1565 | const struct nfs4_state_recovery_ops *ops, |
1566 | struct rpc_cred *cred) | ||
1567 | { | 1567 | { |
1568 | /* Notify the server we're done reclaiming our state */ | 1568 | /* Notify the server we're done reclaiming our state */ |
1569 | if (ops->reclaim_complete) | 1569 | if (ops->reclaim_complete) |
1570 | (void)ops->reclaim_complete(clp); | 1570 | (void)ops->reclaim_complete(clp, cred); |
1571 | } | 1571 | } |
1572 | 1572 | ||
1573 | static void nfs4_clear_reclaim_server(struct nfs_server *server) | 1573 | static void nfs4_clear_reclaim_server(struct nfs_server *server) |
@@ -1612,9 +1612,15 @@ static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp) | |||
1612 | 1612 | ||
1613 | static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) | 1613 | static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) |
1614 | { | 1614 | { |
1615 | const struct nfs4_state_recovery_ops *ops; | ||
1616 | struct rpc_cred *cred; | ||
1617 | |||
1615 | if (!nfs4_state_clear_reclaim_reboot(clp)) | 1618 | if (!nfs4_state_clear_reclaim_reboot(clp)) |
1616 | return; | 1619 | return; |
1617 | nfs4_reclaim_complete(clp, clp->cl_mvops->reboot_recovery_ops); | 1620 | ops = clp->cl_mvops->reboot_recovery_ops; |
1621 | cred = ops->get_clid_cred(clp); | ||
1622 | nfs4_reclaim_complete(clp, ops, cred); | ||
1623 | put_rpccred(cred); | ||
1618 | } | 1624 | } |
1619 | 1625 | ||
1620 | static void nfs_delegation_clear_all(struct nfs_client *clp) | 1626 | static void nfs_delegation_clear_all(struct nfs_client *clp) |