diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-26 09:57:34 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-03-02 18:09:14 -0500 |
commit | 9f0f8e12c48e4bb89192a0de876c77dc1fbfaa75 (patch) | |
tree | 3379cba8f9bee90922f64f53a1978deaeb674969 /fs/nfs | |
parent | ade04647dd56881e285983af3db702d56ee97e86 (diff) |
NFSv4: Pin the superblock while we're returning the delegation
This patch ensures that the superblock doesn't go ahead and disappear
underneath us while the state manager thread is returning delegations.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/delegation.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 5ca502b5f877..be313e791e67 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -474,14 +474,20 @@ restart: | |||
474 | super_list) { | 474 | super_list) { |
475 | if (!nfs_delegation_need_return(delegation)) | 475 | if (!nfs_delegation_need_return(delegation)) |
476 | continue; | 476 | continue; |
477 | inode = nfs_delegation_grab_inode(delegation); | 477 | if (!nfs_sb_active(server->super)) |
478 | if (inode == NULL) | ||
479 | continue; | 478 | continue; |
479 | inode = nfs_delegation_grab_inode(delegation); | ||
480 | if (inode == NULL) { | ||
481 | rcu_read_unlock(); | ||
482 | nfs_sb_deactive(server->super); | ||
483 | goto restart; | ||
484 | } | ||
480 | delegation = nfs_start_delegation_return_locked(NFS_I(inode)); | 485 | delegation = nfs_start_delegation_return_locked(NFS_I(inode)); |
481 | rcu_read_unlock(); | 486 | rcu_read_unlock(); |
482 | 487 | ||
483 | err = nfs_end_delegation_return(inode, delegation, 0); | 488 | err = nfs_end_delegation_return(inode, delegation, 0); |
484 | iput(inode); | 489 | iput(inode); |
490 | nfs_sb_deactive(server->super); | ||
485 | if (!err) | 491 | if (!err) |
486 | goto restart; | 492 | goto restart; |
487 | set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state); | 493 | set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state); |
@@ -815,9 +821,14 @@ restart: | |||
815 | if (test_bit(NFS_DELEGATION_NEED_RECLAIM, | 821 | if (test_bit(NFS_DELEGATION_NEED_RECLAIM, |
816 | &delegation->flags) == 0) | 822 | &delegation->flags) == 0) |
817 | continue; | 823 | continue; |
818 | inode = nfs_delegation_grab_inode(delegation); | 824 | if (!nfs_sb_active(server->super)) |
819 | if (inode == NULL) | ||
820 | continue; | 825 | continue; |
826 | inode = nfs_delegation_grab_inode(delegation); | ||
827 | if (inode == NULL) { | ||
828 | rcu_read_unlock(); | ||
829 | nfs_sb_deactive(server->super); | ||
830 | goto restart; | ||
831 | } | ||
821 | delegation = nfs_start_delegation_return_locked(NFS_I(inode)); | 832 | delegation = nfs_start_delegation_return_locked(NFS_I(inode)); |
822 | rcu_read_unlock(); | 833 | rcu_read_unlock(); |
823 | if (delegation != NULL) { | 834 | if (delegation != NULL) { |
@@ -827,6 +838,7 @@ restart: | |||
827 | nfs_free_delegation(delegation); | 838 | nfs_free_delegation(delegation); |
828 | } | 839 | } |
829 | iput(inode); | 840 | iput(inode); |
841 | nfs_sb_deactive(server->super); | ||
830 | goto restart; | 842 | goto restart; |
831 | } | 843 | } |
832 | } | 844 | } |