All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix for reiserfsck mishandling hash=0
@ 2004-09-15 13:52 Jeff Mahoney
  2004-09-16 12:35 ` Vitaly Fertman
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Mahoney @ 2004-09-15 13:52 UTC (permalink / raw)
  To: ReiserFS List

[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hey all -

When reiserfsck traverses the tree looking for errors, one of the checks
it performs is to see if the hash on disk matches the expected hash,
computed from the filename.

However, the handling of hash = 0 is broken in reiserfsck. In the
kernel, hash = 0 is considered special and is adjusted to 0x80.
reiserfsck doesn't perform this adjustment, and yields fatal errors with
~ instructions to use --rebuild-tree, even though no such error exists.

reiserfs_add_entry() in the semantic rebuild uses the correct
adjustment, from hash_value()

This filename has hash = 0:
G60V0AAT6HJ0000000000000001IC8TRGDUN604xDOCCM2IFN304Q~GM~M2

Attached is a patch to good_name(), allowing reiserfsprogs to properly
handle filenames with hash = 0.

Please apply.

- -Jeff
- --
Jeff Mahoney
SuSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBSEkULPWxlyuTD7IRAouvAKCaPDwiKW47iUD9zkBOtdCsLpofywCfXZNX
5v0/2Z1LB+EYRFNrByTRJDI=
=K18H
-----END PGP SIGNATURE-----

[-- Attachment #2: reiserfsprogs-hash0.diff --]
[-- Type: text/plain, Size: 974 bytes --]

diff -rup reiserfsprogs-3.6.18/reiserfscore/node_formats.c reiserfsprogs-3.6.18.devel/reiserfscore/node_formats.c
--- reiserfsprogs-3.6.18/reiserfscore/node_formats.c	2004-05-28 07:42:43.000000000 -0400
+++ reiserfsprogs-3.6.18.devel/reiserfscore/node_formats.c	2004-09-15 09:05:16.681478544 -0400
@@ -527,9 +527,13 @@ int known_hashes (void)
 }
 
 
-#define good_name(hashfn,name,namelen,deh_offset) \
-(GET_HASH_VALUE ((hashfn) (name, namelen)) == GET_HASH_VALUE (deh_offset))
-
+#define good_name(hashfn,name,namelen,deh_offset)               \
+({                                                              \
+    __u32 __x = (GET_HASH_VALUE ((hashfn) (name, namelen)));    \
+    if (__x == 0)                                               \
+        __x = 128;                                              \
+    __x == GET_HASH_VALUE (deh_offset);                         \
+})
 
 /* this also sets hash function */
 int is_properly_hashed (reiserfs_filsys_t * fs,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-09-16 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-15 13:52 [PATCH] Fix for reiserfsck mishandling hash=0 Jeff Mahoney
2004-09-16 12:35 ` Vitaly Fertman

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.