All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: NeilBrown <neilb@suse.de>
Cc: nfs@lists.sourceforge.net, stable@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] knfsd: Fix a race in closing NFSd connections.
Date: Tue, 6 Feb 2007 17:51:52 -0800	[thread overview]
Message-ID: <20070206175152.39d767dd.akpm@linux-foundation.org> (raw)
In-Reply-To: <1070207001026.9413@suse.de>

On Wed, 7 Feb 2007 11:10:26 +1100
NeilBrown <neilb@suse.de> wrote:

> If you lose this race, it can iput a socket inode twice and you
> get a BUG in fs/inode.c
> 
> When I added the option for user-space to close a socket,
> I added some cruft to svc_delete_socket so that I could call
> that function when closing a socket per user-space request.
> 
> This was the wrong thing to do.  I should have just set SK_CLOSE
> and let normal mechanisms do the work.
> 
> Not only wrong, but buggy.  The locking is all wrong and it openned
> up a race where-by a socket could be closed twice.
> 
> So this patch:
>   Introduces svc_close_socket which sets SK_CLOSE then either leave
>   the close up to a thread, or calls svc_delete_socket if it can
>   get SK_BUSY.
> 
>   Adds a bias to sk_busy which is removed when SK_DEAD is set,
>   This avoid races around shutting down the socket.
> 
>   Changes several 'spin_lock' to 'spin_lock_bh' where the _bh 
>   was missing.
> 

This patch assumes the presence of
knfsd-sunrpc-allow-creating-an-rpc-service-without-registering-with-portmapper.patch which
obviously isn't appropriate for -stable.

Please confirm that the patch which I merged is still OK, thanks.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: NeilBrown <neilb@suse.de>
Cc: stable@kernel.org, nfs@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] knfsd: Fix a race in closing NFSd connections.
Date: Tue, 6 Feb 2007 17:51:52 -0800	[thread overview]
Message-ID: <20070206175152.39d767dd.akpm@linux-foundation.org> (raw)
In-Reply-To: <1070207001026.9413@suse.de>

On Wed, 7 Feb 2007 11:10:26 +1100
NeilBrown <neilb@suse.de> wrote:

> If you lose this race, it can iput a socket inode twice and you
> get a BUG in fs/inode.c
> 
> When I added the option for user-space to close a socket,
> I added some cruft to svc_delete_socket so that I could call
> that function when closing a socket per user-space request.
> 
> This was the wrong thing to do.  I should have just set SK_CLOSE
> and let normal mechanisms do the work.
> 
> Not only wrong, but buggy.  The locking is all wrong and it openned
> up a race where-by a socket could be closed twice.
> 
> So this patch:
>   Introduces svc_close_socket which sets SK_CLOSE then either leave
>   the close up to a thread, or calls svc_delete_socket if it can
>   get SK_BUSY.
> 
>   Adds a bias to sk_busy which is removed when SK_DEAD is set,
>   This avoid races around shutting down the socket.
> 
>   Changes several 'spin_lock' to 'spin_lock_bh' where the _bh 
>   was missing.
> 

This patch assumes the presence of
knfsd-sunrpc-allow-creating-an-rpc-service-without-registering-with-portmapper.patch which
obviously isn't appropriate for -stable.

Please confirm that the patch which I merged is still OK, thanks.

  reply	other threads:[~2007-02-07  1:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070207110636.9166.patches@notabene>
2007-02-07  0:10 ` [PATCH] knfsd: Fix a race in closing NFSd connections NeilBrown
2007-02-07  1:51   ` Andrew Morton [this message]
2007-02-07  1:51     ` Andrew Morton
2007-02-07  2:09     ` Neil Brown
2007-02-07  2:09       ` Neil Brown

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=20070206175152.39d767dd.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=nfs@lists.sourceforge.net \
    --cc=stable@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.