mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-23 23:03:59 +00:00
NFSv4.1: Only reap expired delegations
Fix nfs_reap_expired_delegations() to ensure that we only reap delegations
that are actually expired, rather than triggering on random errors.
Fixes: 45870d6909
("NFSv4.1: Test delegation stateids when server...")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
27a30cf64a
commit
ad11408970
1 changed files with 17 additions and 6 deletions
|
@ -1046,6 +1046,22 @@ void nfs_test_expired_all_delegations(struct nfs_client *clp)
|
||||||
nfs4_schedule_state_manager(clp);
|
nfs4_schedule_state_manager(clp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nfs_delegation_test_free_expired(struct inode *inode,
|
||||||
|
nfs4_stateid *stateid,
|
||||||
|
const struct cred *cred)
|
||||||
|
{
|
||||||
|
struct nfs_server *server = NFS_SERVER(inode);
|
||||||
|
const struct nfs4_minor_version_ops *ops = server->nfs_client->cl_mvops;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
if (!cred)
|
||||||
|
return;
|
||||||
|
status = ops->test_and_free_expired(server, stateid, cred);
|
||||||
|
if (status == -NFS4ERR_EXPIRED || status == -NFS4ERR_BAD_STATEID)
|
||||||
|
nfs_remove_bad_delegation(inode, stateid);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nfs_reap_expired_delegations - reap expired delegations
|
* nfs_reap_expired_delegations - reap expired delegations
|
||||||
* @clp: nfs_client to process
|
* @clp: nfs_client to process
|
||||||
|
@ -1057,7 +1073,6 @@ void nfs_test_expired_all_delegations(struct nfs_client *clp)
|
||||||
*/
|
*/
|
||||||
void nfs_reap_expired_delegations(struct nfs_client *clp)
|
void nfs_reap_expired_delegations(struct nfs_client *clp)
|
||||||
{
|
{
|
||||||
const struct nfs4_minor_version_ops *ops = clp->cl_mvops;
|
|
||||||
struct nfs_delegation *delegation;
|
struct nfs_delegation *delegation;
|
||||||
struct nfs_server *server;
|
struct nfs_server *server;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
@ -1088,11 +1103,7 @@ restart:
|
||||||
nfs4_stateid_copy(&stateid, &delegation->stateid);
|
nfs4_stateid_copy(&stateid, &delegation->stateid);
|
||||||
clear_bit(NFS_DELEGATION_TEST_EXPIRED, &delegation->flags);
|
clear_bit(NFS_DELEGATION_TEST_EXPIRED, &delegation->flags);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
if (cred != NULL &&
|
nfs_delegation_test_free_expired(inode, &stateid, cred);
|
||||||
ops->test_and_free_expired(server, &stateid, cred) < 0) {
|
|
||||||
nfs_revoke_delegation(inode, &stateid);
|
|
||||||
nfs_inode_find_state_and_recover(inode, &stateid);
|
|
||||||
}
|
|
||||||
put_cred(cred);
|
put_cred(cred);
|
||||||
if (nfs4_server_rebooted(clp)) {
|
if (nfs4_server_rebooted(clp)) {
|
||||||
nfs_inode_mark_test_expired_delegation(server,inode);
|
nfs_inode_mark_test_expired_delegation(server,inode);
|
||||||
|
|
Loading…
Add table
Reference in a new issue