mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-06 17:35:20 +02:00
NFS: Avoid unnecessary rescanning of the per-server delegation list
[ Upstream commit f92214e4c3
]
If the call to nfs_delegation_grab_inode() fails, we will not have
dropped any locks that require us to rescan the list.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d8a7055ffd
commit
d07216aa30
|
@ -627,6 +627,9 @@ restart:
|
||||||
prev = delegation;
|
prev = delegation;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
inode = nfs_delegation_grab_inode(delegation);
|
||||||
|
if (inode == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (prev) {
|
if (prev) {
|
||||||
struct inode *tmp = nfs_delegation_grab_inode(prev);
|
struct inode *tmp = nfs_delegation_grab_inode(prev);
|
||||||
|
@ -637,12 +640,6 @@ restart:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = nfs_delegation_grab_inode(delegation);
|
|
||||||
if (inode == NULL) {
|
|
||||||
rcu_read_unlock();
|
|
||||||
iput(to_put);
|
|
||||||
goto restart;
|
|
||||||
}
|
|
||||||
delegation = nfs_start_delegation_return_locked(NFS_I(inode));
|
delegation = nfs_start_delegation_return_locked(NFS_I(inode));
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
@ -1164,7 +1161,6 @@ static int nfs_server_reap_unclaimed_delegations(struct nfs_server *server,
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
restart:
|
restart:
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
restart_locked:
|
|
||||||
list_for_each_entry_rcu(delegation, &server->delegations, super_list) {
|
list_for_each_entry_rcu(delegation, &server->delegations, super_list) {
|
||||||
if (test_bit(NFS_DELEGATION_INODE_FREEING,
|
if (test_bit(NFS_DELEGATION_INODE_FREEING,
|
||||||
&delegation->flags) ||
|
&delegation->flags) ||
|
||||||
|
@ -1175,7 +1171,7 @@ restart_locked:
|
||||||
continue;
|
continue;
|
||||||
inode = nfs_delegation_grab_inode(delegation);
|
inode = nfs_delegation_grab_inode(delegation);
|
||||||
if (inode == NULL)
|
if (inode == NULL)
|
||||||
goto restart_locked;
|
continue;
|
||||||
delegation = nfs_start_delegation_return_locked(NFS_I(inode));
|
delegation = nfs_start_delegation_return_locked(NFS_I(inode));
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
if (delegation != NULL) {
|
if (delegation != NULL) {
|
||||||
|
@ -1296,7 +1292,6 @@ static int nfs_server_reap_expired_delegations(struct nfs_server *server,
|
||||||
nfs4_stateid stateid;
|
nfs4_stateid stateid;
|
||||||
restart:
|
restart:
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
restart_locked:
|
|
||||||
list_for_each_entry_rcu(delegation, &server->delegations, super_list) {
|
list_for_each_entry_rcu(delegation, &server->delegations, super_list) {
|
||||||
if (test_bit(NFS_DELEGATION_INODE_FREEING,
|
if (test_bit(NFS_DELEGATION_INODE_FREEING,
|
||||||
&delegation->flags) ||
|
&delegation->flags) ||
|
||||||
|
@ -1307,7 +1302,7 @@ restart_locked:
|
||||||
continue;
|
continue;
|
||||||
inode = nfs_delegation_grab_inode(delegation);
|
inode = nfs_delegation_grab_inode(delegation);
|
||||||
if (inode == NULL)
|
if (inode == NULL)
|
||||||
goto restart_locked;
|
continue;
|
||||||
spin_lock(&delegation->lock);
|
spin_lock(&delegation->lock);
|
||||||
cred = get_cred_rcu(delegation->cred);
|
cred = get_cred_rcu(delegation->cred);
|
||||||
nfs4_stateid_copy(&stateid, &delegation->stateid);
|
nfs4_stateid_copy(&stateid, &delegation->stateid);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user