linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Nick Piggin <npiggin@kernel.dk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	shaohua.li@intel.com, alex.shi@intel.com,
	torvalds@linux-foundation.org, akpm@linux-foundation.org
Subject: Re: [PATCH] vfs: Fix RCU path walk failiures due to uninitialized nameidata seq number for root directory
Date: Fri, 15 Apr 2011 14:09:15 -0700	[thread overview]
Message-ID: <4DA8B3FB.5020401@linux.intel.com> (raw)
In-Reply-To: <1302892769.2577.24.camel@schen9-DESK>

On 4/15/2011 11:39 AM, Tim Chen wrote:
> During RCU walk in path_lookupat and path_openat, the rcu lookup
> frequently failed because when root directory was looked up, seq number
> was not properly set in nameidata.  We dropped out of RCU walk in
> nameidata_drop_rcu due to mismatch in directory entry's seq number.  We
> reverted to slow path walk that need to take references.

Thanks Tim. Adding Andrew, Linus too. IMHO this fix is quite important to
actually make the fabled RCU dcache work -- without it it's just slower 
because
it will fallback nearly allways.

And it's a correctness fix because with the bogus sequence number you 
could fail
to detect a race on root's dentry, leading to very subtle malfunction.

Could it be merged ASAP please?
Also should be a stable candidate for .38 (whoever merges it please
add a Cc: stable@kernel.org # .38)

Reviewed-by: Andi Kleen <ak@linux.intel.com>

-Andi

> With the following patch, I saw a 50% increase in an exim mail server
> benchmark throughput on a 4-socket Nehalem-EX system.
>
> Thanks.
>
> Tim
>
> Signed-off-by: Tim Chen<tim.c.chen@linux.intel.com>
> diff --git a/fs/namei.c b/fs/namei.c
> index 3cb616d..e4b27a6 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -697,6 +697,7 @@ static __always_inline void set_root_rcu(struct nameidata *nd)
>   		do {
>   			seq = read_seqcount_begin(&fs->seq);
>   			nd->root = fs->root;
> +			nd->seq = __read_seqcount_begin(&nd->root.dentry->d_seq);
>   		} while (read_seqcount_retry(&fs->seq, seq));
>   	}
>   }
>
>

  reply	other threads:[~2011-04-15 21:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15 18:39 [PATCH] vfs: Fix RCU path walk failiures due to uninitialized nameidata seq number for root directory Tim Chen
2011-04-15 21:09 ` Andi Kleen [this message]
2011-04-15 21:54   ` Linus Torvalds
2011-04-16  5:43     ` Sedat Dilek
2011-04-16 10:27 ` Shi, Alex

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=4DA8B3FB.5020401@linux.intel.com \
    --to=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.shi@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@kernel.dk \
    --cc=shaohua.li@intel.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).