All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: ReiserFS List <reiserfs-list@namesys.com>
Subject: [PATCH] Fix for reiserfsck mishandling hash=0
Date: Wed, 15 Sep 2004 09:52:20 -0400	[thread overview]
Message-ID: <41484914.1000109@suse.com> (raw)

[-- 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,

             reply	other threads:[~2004-09-15 13:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-15 13:52 Jeff Mahoney [this message]
2004-09-16 12:35 ` [PATCH] Fix for reiserfsck mishandling hash=0 Vitaly Fertman

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=41484914.1000109@suse.com \
    --to=jeffm@suse.com \
    --cc=reiserfs-list@namesys.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 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.