LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jeff Layton <jlayton@redhat.com>
Cc: neilb@suse.de, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] NLM: have nlm_shutdown_hosts kill off all NLM RPC tasks
Date: Fri, 18 Jan 2008 16:43:45 -0500	[thread overview]
Message-ID: <20080118214345.GM15158@fieldses.org> (raw)
In-Reply-To: <1200319518-22422-5-git-send-email-jlayton@redhat.com>

On Mon, Jan 14, 2008 at 09:05:18AM -0500, Jeff Layton wrote:
> If we're shutting down all the nlm_hosts anyway, then it doesn't make
> sense to allow RPC calls to linger. Allowing them to do so can mean
> that the RPC calls can outlive the currently running lockd and can lead
> to a use after free situation.

I assume that all new rpc calls are created by the lockd thread itself
(which also calls nlm_shutdown_hosts(), which guarantees that there
can't be someone about to make an rpc call using the clnt we're
destroying here?

By the way, any idea what the nlm_shutdown_hosts() call in exit_nlm() is
doing?

--b.

> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/lockd/host.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/lockd/host.c b/fs/lockd/host.c
> index 572601e..8771484 100644
> --- a/fs/lockd/host.c
> +++ b/fs/lockd/host.c
> @@ -377,8 +377,10 @@ nlm_shutdown_hosts(void)
>  	/* First, make all hosts eligible for gc */
>  	dprintk("lockd: nuking all hosts...\n");
>  	for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) {
> -		hlist_for_each_entry(host, pos, chain, h_hash)
> +		hlist_for_each_entry(host, pos, chain, h_hash) {
>  			host->h_expires = jiffies - 1;
> +			rpc_killall_tasks(host->h_rpcclnt);
> +		}
>  	}
>  
>  	/* Then, perform a garbage collection pass */
> -- 
> 1.5.3.7
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2008-01-18 21:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-14 14:05 [PATCH 0/4] Intro: convert lockd to kthread and fix use-after-free (try #8) Jeff Layton
2008-01-14 14:05 ` [PATCH 1/4] SUNRPC: spin svc_rqst initialization to its own function Jeff Layton
2008-01-14 14:05   ` [PATCH 2/4] SUNRPC: export svc_sock_update_bufs Jeff Layton
2008-01-14 14:05     ` [PATCH 3/4] NLM: Convert lockd to use kthreads Jeff Layton
2008-01-14 14:05       ` [PATCH 4/4] NLM: have nlm_shutdown_hosts kill off all NLM RPC tasks Jeff Layton
2008-01-18 21:43         ` J. Bruce Fields [this message]
2008-01-18 22:07           ` Jeff Layton
2008-01-18 20:59   ` [PATCH 1/4] SUNRPC: spin svc_rqst initialization to its own function J. Bruce Fields
2008-01-18 21:48     ` Jeff Layton
2008-01-18 21:51       ` J. Bruce Fields

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=20080118214345.GM15158@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=jlayton@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --subject='Re: [PATCH 4/4] NLM: have nlm_shutdown_hosts kill off all NLM RPC tasks' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).