[pnfs] [PATCH 4/12] use kref for nfsd nfs4_client
J. Bruce Fields
bfields at fieldses.org
Tue May 8 17:27:50 EDT 2007
On Tue, May 08, 2007 at 10:26:12PM +0300, Benny Halevy wrote:
> So the first step can be justified in mainline as in nfsd4_probe_callback's
> out_rpciod error case atomic_dec(&clp->cl_count) won't free up the client
> structure if it was expired concurrently. expire_client shuts down the
> callback rpc path so that may wait for nfsd4_probe_callback to finish
> but I'm not sure. At any rate, calling put_nfs4_client() there is
> more robust.
Yes, the destruction of the rpc_client shouldn't succeed until any
outstanding tasks are done. But I agree that the reference counting
there is at best odd.
Actually, the caller (setclientid_confirm) also works with this client
without a reference; if the client could be expired at any time, then
that would already be a problem for it. So I suppose it's just
depending on the state lock to prevent the client expiration. We're
taking the reference in nfsd4_probe_callback() because we know it may be
held after the state lock is dropped.
I think that's the real reason the big state lock makes me
uncomfortable--there's so many places like this where we aren't doing
the kind of reference counting and locking that I'm used to elsewhere,
because we're counting on mutual exclusion between these huge
complicated bits of code.
--b.
More information about the pNFS
mailing list