Linux NFS development
 help / color / mirror / Atom feed
From: Gabriel Barazer <gabriel@oxeva.fr>
To: Neil Brown <neilb@suse.de>
Cc: nfs@lists.sourceforge.net
Subject: Re: mountd randomly crash and panic the server
Date: Tue, 01 May 2007 01:46:04 +0200	[thread overview]
Message-ID: <46367FBC.6000007@oxeva.fr> (raw)
In-Reply-To: <17956.8604.672536.126674@notabene.brown>

On 04/17/2007 3:23:40 +0200, Neil Brown <neilb@suse.de> wrote:

> 
> I did end up just hunting through the patches between 2.6.18 and
> 2.6.20 and I think I have found it (I had already looked at the code
> where the bug is, but didn't see it the first time :-().
> 
> Could you try this patch and report the results please?
> I'm very confident that the patch is correct and required, but I would
> like to also know that it fixes your problem.
> 

By the way, I patched the 2.6.20.7 kernel since you provided the patch, 
and haven't encountered any stability problem, except some CFQ scheduler 
  related kernel panics, which are, I suppose, not linked to the NFS 
problem (I still mention it because unrelated but linked problems like 
this sometimes happens)

Thanks for the patch !

Gabriel Barazer

> Thanks
> NeilBrown
> 
> ---------------------------------------------
> Use a spinlock to protect sk_info_authunix
> 
> sk_info_authunix is not being protected properly so the object that
> it points to can be cache_put twice, leading to corruption.
> 
> We borrow svsk->sk_defer_lock to provide the protection.  We should probably
> rename that lock to have a more generic name.
> 
> Signed-off-by: Neil Brown <neilb@suse.de>
> 
> ### Diffstat output
>  ./net/sunrpc/svcauth_unix.c |   21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff .prev/net/sunrpc/svcauth_unix.c ./net/sunrpc/svcauth_unix.c
> --- .prev/net/sunrpc/svcauth_unix.c	2007-04-17 11:18:44.000000000 +1000
> +++ ./net/sunrpc/svcauth_unix.c	2007-04-17 11:19:18.000000000 +1000
> @@ -383,7 +383,10 @@ void svcauth_unix_purge(void)
>  static inline struct ip_map *
>  ip_map_cached_get(struct svc_rqst *rqstp)
>  {
> -	struct ip_map *ipm = rqstp->rq_sock->sk_info_authunix;
> +	struct ip_map *ipm;
> +	struct svc_sock *svsk = rqstp->rq_sock;
> +	spin_lock(&svsk->sk_defer_lock);
> +	ipm = svsk->sk_info_authunix;
>  	if (ipm != NULL) {
>  		if (!cache_valid(&ipm->h)) {
>  			/*
> @@ -391,12 +394,14 @@ ip_map_cached_get(struct svc_rqst *rqstp
>  			 * remembered, e.g. by a second mount from the
>  			 * same IP address.
>  			 */
> -			rqstp->rq_sock->sk_info_authunix = NULL;
> +			svsk->sk_info_authunix = NULL;
> +			spin_unlock(&svsk->sk_defer_lock);
>  			cache_put(&ipm->h, &ip_map_cache);
>  			return NULL;
>  		}
>  		cache_get(&ipm->h);
>  	}
> +	spin_unlock(&svsk->sk_defer_lock);
>  	return ipm;
>  }
>  
> @@ -405,9 +410,15 @@ ip_map_cached_put(struct svc_rqst *rqstp
>  {
>  	struct svc_sock *svsk = rqstp->rq_sock;
>  
> -	if (svsk->sk_sock->type == SOCK_STREAM && svsk->sk_info_authunix == NULL)
> -		svsk->sk_info_authunix = ipm;	/* newly cached, keep the reference */
> -	else
> +	spin_lock(&svsk->sk_defer_lock);
> +	if (svsk->sk_sock->type == SOCK_STREAM &&
> +	    svsk->sk_info_authunix == NULL) {
> +		/* newly cached, keep the reference */
> +		svsk->sk_info_authunix = ipm;
> +		ipm = NULL;
> +	}
> +	spin_unlock(&svsk->sk_defer_lock);
> +	if (ipm)
>  		cache_put(&ipm->h, &ip_map_cache);
>  }
>  

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

  reply	other threads:[~2007-04-30 23:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-11 15:11 mountd randomly crash and panic the server Gabriel Barazer
2007-04-16  9:26 ` Gabriel Barazer
2007-04-16 10:47   ` Neil Brown
2007-04-16 14:07     ` Gabriel Barazer
2007-04-17  1:23       ` Neil Brown
2007-04-30 23:46         ` Gabriel Barazer [this message]
2007-04-30 23:59           ` Neil Brown
2007-05-02  9:03             ` Gabriel Barazer
2007-05-02 11:29               ` Neil Brown
  -- strict thread matches above, loose matches on Subject: below --
2007-04-11 15:12 Gabriel Barazer

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=46367FBC.6000007@oxeva.fr \
    --to=gabriel@oxeva.fr \
    --cc=neilb@suse.de \
    --cc=nfs@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox