Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4eaea134 authored by J. Bruce Fields's avatar J. Bruce Fields
Browse files

nfsd: improve client_has_state to check for unused openowners



At least in the v4.0 case openowners can hang around for a while after
last close, but they shouldn't really block (for example), a new mount
with a different principal.

Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 2b634821
Loading
Loading
Loading
Loading
+12 −8
Original line number Original line Diff line number Diff line
@@ -2256,16 +2256,20 @@ nfsd4_set_ex_flags(struct nfs4_client *new, struct nfsd4_exchange_id *clid)
	clid->flags = new->cl_exchange_flags;
	clid->flags = new->cl_exchange_flags;
}
}


static bool client_has_openowners(struct nfs4_client *clp)
{
	struct nfs4_openowner *oo;

	list_for_each_entry(oo, &clp->cl_openowners, oo_perclient) {
		if (!list_empty(&oo->oo_owner.so_stateids))
			return true;
	}
	return false;
}

static bool client_has_state(struct nfs4_client *clp)
static bool client_has_state(struct nfs4_client *clp)
{
{
	/*
	return client_has_openowners(clp)
	 * Note clp->cl_openowners check isn't quite right: there's no
	 * need to count owners without stateid's.
	 *
	 * Also note in 4.0 case should also be checking for openowners
	 * kept around just for close handling.
	 */
	return !list_empty(&clp->cl_openowners)
#ifdef CONFIG_NFSD_PNFS
#ifdef CONFIG_NFSD_PNFS
		|| !list_empty(&clp->cl_lo_states)
		|| !list_empty(&clp->cl_lo_states)
#endif
#endif