public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com
Subject: Re: Regression introduced by bfcfaa77bdf0f775263e906015982a608df01c76 (vfs: use 'unsigned long' accesses for dcache name comparison and hashing)
Date: Thu, 22 Mar 2012 21:59:52 +0000	[thread overview]
Message-ID: <20120322215952.GG6589@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CA+55aFxBS3bJoB8BiUR3Ni2KqpK5ofxSBC9+LcgRRoxYGAMKjQ@mail.gmail.com>

On Thu, Mar 22, 2012 at 02:54:37PM -0700, Linus Torvalds wrote:
> On Thu, Mar 22, 2012 at 2:41 PM, Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com> wrote:
> >
> > Works for me! Thanks for coming up with a patch so quickly. Please add
> >
> > Reported-and-Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> Goodie. Al, I can commit it as yours, but I'd want a sign-off and a
> commit message for that. Otherwise I'll take credit..

Hmm...  How about

Fix full_name_hash() behaviour when length is a multiple of 8

We want it to match what hash_name() is doing, which means extra
multiply by 9 in this case...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/fs/namei.c b/fs/namei.c
index 13e6a1f..7451d6f8 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1439,10 +1439,10 @@ unsigned int full_name_hash(const unsigned char *name, unsigned int len)
 
 	for (;;) {
 		a = *(unsigned long *)name;
-		hash *= 9;
 		if (len < sizeof(unsigned long))
 			break;
 		hash += a;
+		hash *= 9;
 		name += sizeof(unsigned long);
 		len -= sizeof(unsigned long);
 		if (!len)

  reply	other threads:[~2012-03-22 21:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-22 18:38 Regression introduced by bfcfaa77bdf0f775263e906015982a608df01c76 (vfs: use 'unsigned long' accesses for dcache name comparison and hashing) Konrad Rzeszutek Wilk
2012-03-22 19:33 ` Eric Paris
2012-03-22 20:03   ` Eric Paris
2012-03-22 20:10     ` Al Viro
2012-03-22 20:09 ` Al Viro
2012-03-22 20:24   ` Al Viro
2012-03-22 20:36     ` Al Viro
2012-03-22 20:42       ` Linus Torvalds
2012-03-22 21:41       ` Konrad Rzeszutek Wilk
2012-03-22 21:54         ` Linus Torvalds
2012-03-22 21:59           ` Al Viro [this message]
2012-03-22 20:38     ` Linus Torvalds
2012-03-22 20:44       ` Al Viro
2012-03-22 20:52         ` Linus Torvalds

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=20120322215952.GG6589@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=xen-devel@lists.xensource.com \
    /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