From: Benny Halevy <bhalevy@panasas.com>
To: andros@netapp.com
Cc: iisaman@netapp.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 3/3] pnfs-submit: callbacks cannot use an nfs_client that is being freed
Date: Thu, 11 Nov 2010 15:22:14 +0200 [thread overview]
Message-ID: <4CDBEE06.1050309@panasas.com> (raw)
In-Reply-To: <1289484640-4100-4-git-send-email-andros@netapp.com>
On 2010-11-11 16:10, andros@netapp.com wrote:
> From: Andy Adamson <andros@netapp.com>
>
> 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@netapp.com>
> ---
> 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
next prev parent reply other threads:[~2010-11-11 13:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-11 14:10 [PATCH 0/3] Fix session draining and back channel processing andros
2010-11-11 2:13 ` Andy Adamson
2010-11-11 14:10 ` [PATCH 1/3] pnfs-submit: set back channel highest slot used andros
2010-11-11 14:10 ` [PATCH 2/3] pnfs-submit: add back channel draining andros
2010-11-11 14:10 ` [PATCH 3/3] pnfs-submit: callbacks cannot use an nfs_client that is being freed andros
2010-11-11 13:22 ` Benny Halevy [this message]
2010-11-12 8:13 ` William A. (Andy) Adamson
[not found] ` <AANLkTi=55LGD+s+tg5d1wVyMdL9c-SmCguNLW_8veR8X-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-12 10:08 ` Benny Halevy
2010-11-14 12:08 ` [PATCH] SQUASHME: pnfs-submit: highest backchannel slot used for !CONFIG_NFS_V4_1 Benny Halevy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CDBEE06.1050309@panasas.com \
--to=bhalevy@panasas.com \
--cc=andros@netapp.com \
--cc=iisaman@netapp.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.