Commit bb3d1a3b authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

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: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Tested-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 45870d69
...@@ -884,6 +884,13 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp) ...@@ -884,6 +884,13 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp)
rcu_read_unlock(); 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, static void nfs_mark_test_expired_delegation(struct nfs_server *server,
struct nfs_delegation *delegation) struct nfs_delegation *delegation)
{ {
...@@ -892,6 +899,19 @@ static void nfs_mark_test_expired_delegation(struct nfs_server *server, ...@@ -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); 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) static void nfs_delegation_mark_test_expired_server(struct nfs_server *server)
{ {
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
...@@ -964,6 +984,12 @@ void nfs_reap_expired_delegations(struct nfs_client *clp) ...@@ -964,6 +984,12 @@ void nfs_reap_expired_delegations(struct nfs_client *clp)
nfs_inode_find_state_and_recover(inode, &stateid); nfs_inode_find_state_and_recover(inode, &stateid);
} }
put_rpccred(cred); 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); iput(inode);
nfs_sb_deactive(server->super); nfs_sb_deactive(server->super);
goto restart; goto restart;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment