Skip to contentSkip to conversation

Build errors in mainline due to "fs/namei.c:,Add hashlen_string() function"

PATCH In review Guenter Roeck 3 participants 9 messages May 29, 2016 VFS

lore
Share & tools
lore
#0 lore raw

I see:

fs/dcache.c:1673: undefined reference to `hashlen_string'

For:

	total: 148 pass: 22 fail: 126

I didn't bisect, but I strongly suspect commit fcfd2fbf22d2 ("fs/namei.c:
Add hashlen_string() function") because the new function is not provided if DCACHE_WORD_ACCESS is not enabled. This affects almost all architectures.

Reverting 468a9428521e, 2a18da7a9c78, and fcfd2fbf22d2 fixed the problem for me in a couple of test builds, but I don't know if all three patches need to be reverted, or if reverting those patches fixes the problem for all builds, or if the revert is sufficient.

Guenter

#1 lore raw
Quoted 4 lines

Reverting 468a9428521e, 2a18da7a9c78, and fcfd2fbf22d2 fixed the problem for me in a couple of test builds, but I don't know if all three patches need to be reverted, or if reverting those patches fixes the problem for all builds, or if the revert is sufficient.

Oh, fuck me so fucking hard.

the function is there, just when I renamed it from "hash_string" I only did one copy.

Find hash_string() and rename it (and the EXPORT).

Patch coming ASAP.

Sorry.

#2 lore raw

PATCH 1/1 Rename other copy of hash_string to hashlen_string

In reply to Guenter Roeck

The original name was simply hash_string(), but that conflicted with a function with that name in drivers/base/power/trace.c, and I decided that calling it "hashlen_" was better anyway.

But you have to do it in two places.

Fixes fcfd2fbf22d2587196890103d41e3d554c47da0e
---
 fs/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/namei.c +2 -2
index 968dae02..aefba699 100644
@@ -1952,7 +1952,7 @@ unsigned int full_name_hash(const char *name, unsigned int len)
 EXPORT_SYMBOL(full_name_hash);
 
 /* Return the "hash_len" (hash and length) of a null-terminated string */
-u64 hash_string(const char *name)
+u64 hashlen_string(const char *name)
 {
 	unsigned long hash = init_name_hash();
 	unsigned long len = 0, c;
@@ -1965,7 +1965,7 @@ u64 hash_string(const char *name)
 	} while (c);
 	return hashlen_create(end_name_hash(hash), len);
 }
-EXPORT_SYMBOL(hash_string);
+EXPORT_SYMBOL(hashlen_string);
 
 /*
  * We know there's a real path component here of at least
Signature · 1 line
2.8.1
#3 lore raw

Re: [PATCH] Rename other copy of hash_string to hashlen_string

Hi Georges,

Quoted 26 lines · George Spelvin

The original name was simply hash_string(), but that conflicted with a function with that name in drivers/base/power/trace.c, and I decided that calling it "hashlen_" was better anyway.

But you have to do it in two places.

Fixes fcfd2fbf22d2587196890103d41e3d554c47da0e
---
 fs/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/namei.c +1 -1
index 968dae02..aefba699 100644
@@ -1952,7 +1952,7 @@ unsigned int full_name_hash(const char *name, unsigned int len)
 EXPORT_SYMBOL(full_name_hash);
 
 /* Return the "hash_len" (hash and length) of a null-terminated string */
-u64 hash_string(const char *name)
+u64 hashlen_string(const char *name)
 {
        unsigned long hash = init_name_hash();
        unsigned long len = 0, c;

fs/namei.c u64 hash_string(const char *name) · line 1968

Quoted 5 lines
fs/namei.c +1 -1
@@ -1965,7 +1965,7 @@ u64 hash_string(const char *name)
        } while (c);
        return hashlen_create(end_name_hash(hash), len);
 }
-EXPORT_SYMBOL(hash_string);
+EXPORT_SYMBOL(hashlen_string);

That version fails the test. On m68k/ARAnyM:

test_hash: hashlen_string(256..256) returned length 1, expected 0

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#4 lore raw

Re: [PATCH] Rename other copy of hash_string to hashlen_string

Quoted 3 lines

That version fails the test. On m68k/ARAnyM:

test_hash: hashlen_string(256..256) returned length 1, expected 0

Just kill me. :-(

I didn't change that code, so I didn't re-test it. But I changed the test.

fs/namei.c +0 -0
index aefba699..dcb85255 100644
@@ -1958,11 +1958,11 @@ u64 hashlen_string(const char *name)
	unsigned long len = 0, c;
 
	c = (unsigned char)*name;
-       do {
+       while (c) {
		len++;
		hash = partial_name_hash(c, hash);
		c = (unsigned char)name[len];
-       } while (c);
+       }
	return hashlen_create(end_name_hash(hash), len);

}
EXPORT_SYMBOL(hashlen_string);

#5 lore raw

PATCH 1/1 fs/namei.c. If we way we want zero-length string support, mean it

In reply to Geert Uytterhoeven
Quoted 1 line

From 4b237fc0c5addf58ef0e0bbd3740d64007c36375 Mon Sep 17 00:00:00 2001

From: George Spelvin <[email protected]>
Date: Sun, 29 May 2016 08:05:56 -0400
Subject: [PATCH] fs/namei.c. If we way we want zero-length string suppor mean it.

hash_name() is not changed for speed, but the more general purpose hashlen_string need to support zero-length strings.

Fixes fcfd2fbf22d2587196890103d41e3d554c47da0e

---
Just kill me. I didn't re-test the side of the code that I "didn't touch", but at Bruce Field's (correct!) prompting, I changed the test to cover a corner case it hadn't addressed.

 fs/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/namei.c +2 -2
index aefba699..dcb85255 100644
@@ -1958,11 +1958,11 @@ u64 hashlen_string(const char *name)
 	unsigned long len = 0, c;
 
 	c = (unsigned char)*name;
-	do {
+	while (c) {
 		len++;
 		hash = partial_name_hash(c, hash);
 		c = (unsigned char)name[len];
-	} while (c);
+	}
 	return hashlen_create(end_name_hash(hash), len);
 }
 EXPORT_SYMBOL(hashlen_string);
Signature · 1 line
2.8.1
Tested-by on v1 1/1
#6 lore raw

Re: [PATCH] fs/namei.c. If we way we want zero-length string support, mean it

Hi George,

Quoted 10 lines · George Spelvin

From 4b237fc0c5addf58ef0e0bbd3740d64007c36375 Mon Sep 17 00:00:00 2001
From: George Spelvin <[email protected]>
Date: Sun, 29 May 2016 08:05:56 -0400
Subject: [PATCH] fs/namei.c. If we way we want zero-length string suppor mean it.

hash_name() is not changed for speed, but the more general purpose hashlen_string need to support zero-length strings.

Fixes fcfd2fbf22d2587196890103d41e3d554c47da0e

FTR:

test_hash: __hash_32() has no arch implementation to test.
test_hash: hash_32() has no arch implementation to test.
test_hash: hash_64() has no arch implementation to test.
test_hash: 33152 tests passed.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#7 lore raw

PATCH 1/1 fs/namei.c: Update !CONFIG_DCACHE_WORD_ACCESS case

In reply to Geert Uytterhoeven
Quoted 1 line

From be5e653c0d5ec890c32a48851dcd0a347df8e5fa Mon Sep 17 00:00:00 2001

From: George Spelvin <[email protected]>
Date: Sun, 29 May 2016 01:23:14 -0400
Subject: [PATCH] fs/namei.c: Update !CONFIG_DCACHE_WORD_ACCESS case

A couple of late changes to the previous patch didn't update the !CONFIG_DCACHE_WORD_ACCESS option correspondingly. It hadn't changed, so didn't need re-testing, right?

Yeah. Let that be a lesson to me.

Specifically the caller got changed in two ways:
- The function name was changed from v1 to avoid a collision.
- The self-test was updated to cover zero-length strings; the function needs to be updated, too.

Fixes fcfd2fbf22d2587196890103d41e3d554c47da0e

---
Here's the combined patch, if that's preferred. Obviously Correct(tm), but I'm starting the full test quite right now.

That just takes a few hours. (I have to reboot two machines multiple times with 32- and 64-bit kernels and and test NFS between them.)

 fs/namei.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/namei.c +4 -4
index 968dae02..dcb85255 100644
@@ -1952,20 +1952,20 @@ unsigned int full_name_hash(const char *name, unsigned int len)
 EXPORT_SYMBOL(full_name_hash);
 
 /* Return the "hash_len" (hash and length) of a null-terminated string */
-u64 hash_string(const char *name)
+u64 hashlen_string(const char *name)
 {
 	unsigned long hash = init_name_hash();
 	unsigned long len = 0, c;
 
 	c = (unsigned char)*name;
-	do {
+	while (c) {
 		len++;
 		hash = partial_name_hash(c, hash);
 		c = (unsigned char)name[len];
-	} while (c);
+	}
 	return hashlen_create(end_name_hash(hash), len);
 }
-EXPORT_SYMBOL(hash_string);
+EXPORT_SYMBOL(hashlen_string);
 
 /*
  * We know there's a real path component here of at least
Signature · 1 line
2.8.1