From: Mark Tinguely <tinguely@sgi.com>
To: XFS Mailing List <xfs@oss.sgi.com>
Subject: [PATCH] xfsprogs: fix directory hash ordering bug
Date: Mon, 07 Apr 2014 14:00:34 -0500 [thread overview]
Message-ID: <20140407190101.292316075@sgi.com> (raw)
In-Reply-To: 20140328173430.622616177@sgi.com
[-- Attachment #1: libxfs-fix-directory-bad-hash-order.patch --]
[-- Type: text/plain, Size: 2076 bytes --]
Commit f5ea1100 ("xfs: add CRCs to dir2/da node blocks") introduced
in 3.10 incorrectly converted the btree hash index array pointer in
xfs_da3_fixhashpath(). It resulted in the the current hash always
being compared against the first entry in the btree rather than the
current block index into the btree block's hash entry array. As a
result, it was comparing the wrong hashes, and so could misorder the
entries in the btree.
For most cases, this doesn't cause any problems as it requires hash
collisions to expose the ordering problem. However, when there are
hash collisions within a directory there is a very good probability
that the entries will be ordered incorrectly and that actually
matters when duplicate hashes are placed into or removed from the
btree block hash entry array.
This bug results in an on-disk directory corruption and that results
in directory verifier functions throwing corruption warnings into
the logs. While no data or directory entries are lost, access to
them may be compromised, and attempts to remove entries from a
directory that has suffered from this corruption may result in a
filesystem shutdown. xfs_repair will fix the directory hash
ordering without data loss occuring.
[dchinner: wrote useful a commit message]
Ported from equivalent kernel commit c88547a8.
Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
libxfs/xfs_da_btree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: b/libxfs/xfs_da_btree.c
===================================================================
--- a/libxfs/xfs_da_btree.c
+++ b/libxfs/xfs_da_btree.c
@@ -1313,7 +1313,7 @@ xfs_da3_fixhashpath(
node = blk->bp->b_addr;
xfs_da3_node_hdr_from_disk(&nodehdr, node);
btree = xfs_da3_node_tree_p(node);
- if (be32_to_cpu(btree->hashval) == lasthash)
+ if (be32_to_cpu(btree[blk->index]->hashval) == lasthash)
break;
blk->hashval = lasthash;
btree[blk->index].hashval = cpu_to_be32(lasthash);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-04-07 19:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 17:33 [PATCH] xfs: fix bad hash ordering Mark Tinguely
2014-03-28 19:07 ` Ben Myers
2014-03-31 0:10 ` Dave Chinner
2014-03-31 0:35 ` Eric Sandeen
2014-03-31 16:42 ` Mark Tinguely
2014-03-31 21:40 ` Dave Chinner
2014-04-01 2:22 ` Mark Tinguely
2014-04-01 22:03 ` Dave Chinner
2014-04-07 19:00 ` Mark Tinguely [this message]
2014-04-08 8:56 ` [PATCH] xfsprogs: fix directory hash ordering bug Dave Chinner
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=20140407190101.292316075@sgi.com \
--to=tinguely@sgi.com \
--cc=xfs@oss.sgi.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;
as well as URLs for NNTP newsgroup(s).