diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-09-22 13:39:00 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2016-09-27 14:33:49 -0400 |
commit | bb3d1a3b24b61d8dd87e2d8c127a92ec8dd5d0d4 (patch) | |
tree | d5a9ce0df0b36228988d2c93f1106e71e93ee903 /fs/nfs | |
parent | 45870d6909d5a1f702d2a3781d8fc831301d13c8 (diff) | |
download | linux-stable-bb3d1a3b24b61d8dd87e2d8c127a92ec8dd5d0d4.tar.gz linux-stable-bb3d1a3b24b61d8dd87e2d8c127a92ec8dd5d0d4.tar.bz2 linux-stable-bb3d1a3b24b61d8dd87e2d8c127a92ec8dd5d0d4.zip |
NFSv4.1: Deal with server reboots during delegation expiration recovery
Ensure that if the server reboots while we're testing and recovering
from revoked delegations, we exit to allow the state manager to
handle matters.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Tested-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/delegation.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index dfb300901f7e..0ffead281555 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -884,6 +884,13 @@ restart: rcu_read_unlock(); } +static inline bool nfs4_server_rebooted(const struct nfs_client *clp) +{ + return (clp->cl_state & (BIT(NFS4CLNT_CHECK_LEASE) | + BIT(NFS4CLNT_LEASE_EXPIRED) | + BIT(NFS4CLNT_SESSION_RESET))) != 0; +} + static void nfs_mark_test_expired_delegation(struct nfs_server *server, struct nfs_delegation *delegation) { @@ -892,6 +899,19 @@ static void nfs_mark_test_expired_delegation(struct nfs_server *server, set_bit(NFS4CLNT_DELEGATION_EXPIRED, &server->nfs_client->cl_state); } +static void nfs_inode_mark_test_expired_delegation(struct nfs_server *server, + struct inode *inode) +{ + struct nfs_delegation *delegation; + + rcu_read_lock(); + delegation = rcu_dereference(NFS_I(inode)->delegation); + if (delegation) + nfs_mark_test_expired_delegation(server, delegation); + rcu_read_unlock(); + +} + static void nfs_delegation_mark_test_expired_server(struct nfs_server *server) { struct nfs_delegation *delegation; @@ -964,6 +984,12 @@ restart: nfs_inode_find_state_and_recover(inode, &stateid); } put_rpccred(cred); + if (nfs4_server_rebooted(clp)) { + nfs_inode_mark_test_expired_delegation(server,inode); + iput(inode); + nfs_sb_deactive(server->super); + return; + } iput(inode); nfs_sb_deactive(server->super); goto restart; |