On 2010-11-11 16:10, andros@xxxxxxxxxx wrote: > From: Andy Adamson <andros@xxxxxxxxxx> > > Guarantee that the nfs_client exists when referenced to by callback processing > by not procssing callbacks on an nfs_client in the process of being freed. > > Signed-off-by: Andy Adamson <andros@xxxxxxxxxx> > --- > fs/nfs/client.c | 8 ++++++-- > 1 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/fs/nfs/client.c b/fs/nfs/client.c > index dbf43e7..86657ee 100644 > --- a/fs/nfs/client.c > +++ b/fs/nfs/client.c > @@ -392,7 +392,9 @@ struct nfs_client *nfs_find_client(const struct sockaddr *addr, u32 nfsversion) > if (!nfs_sockaddr_match_ipaddr(addr, clap)) > continue; > > - atomic_inc(&clp->cl_count); > + /* Don't return an nfs_client that is being freed */ > + if (!atomic_inc_not_zero(&clp->cl_count)) > + continue; > spin_unlock(&nfs_client_lock); > return clp; > } > @@ -425,7 +427,9 @@ struct nfs_client *nfs_find_client_next(struct nfs_client *clp) > if (!nfs_sockaddr_match_ipaddr(sap, clap)) > continue; > > - atomic_inc(&clp->cl_count); > + /* Don't return an nfs_client that is being freed */ > + if (!atomic_inc_not_zero(&clp->cl_count)) > + continue; > spin_unlock(&nfs_client_lock); > return clp; > } Hmm, nfs_put_client deletes the client when cl_count reaches zero so how can cl_count be zero while clp is listed? Benny In put_nfs_client -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html