Red Hat Bugzilla – Bug 679566
gfs2_edit savemeta doesn't save all leaf blocks for large dirs
Last modified: 2011-12-06 09:50:54 EST
+++ This bug was initially created as a clone of Bug #679565 +++
Crosswrite to RHEL6
Description of problem:
If you have a large enough directory, gfs2_edit savemeta
won't save all of its leaf blocks.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. mkfs.gfs2 -O -t bobs_roth:roth_lv -p lock_dlm -j 4 /dev/roth_vg/roth_lv
2. mount -tgfs2 /dev/roth_vg/roth_lv /mnt/gfs2
3. mkdir /mnt/gfs2/bigdir
4. for i in `seq 1 543562` ; do dd if=/dev/zero of=/mnt/gfs2/bigdir/gfs2.$i bs=4K count=3 &>/dev/null; done
5. umount /mnt/gfs2
6. gfs2_edit savemeta /dev/roth_vg/roth_lv halfamillion12Kfiles.meta
7. gfs2_edit printsavedmeta halfamillion12Kfiles.meta > /tmp/gronk
8. grep "directory leaf" /tmp/gronk | wc -l
Patch in hand
--- Additional comment from firstname.lastname@example.org on 2011-02-22 16:22:25 EST ---
Requesting ack flags for 5.7.
Requesting ack flags for rhel6
Created attachment 490835 [details]
Ran into this bug while working on a customer critsit,
so I had to crosswrite the patch. So here it is.
Verified it on RHEL6 system gfs-i24c-01.
Patch 0ce6e00 was pushed to the RHEL6 branch of the cluster.git
tree for inclusion into 6.2. Changing status to POST until this
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
A user performs the command "gfs2_edit savemeta" to save off the metadata for a target GFS2 file system. However, not all of the directory information is saved for large directories. If the metadata is restored to another device, fsck.gfs2 will find directory corruption due to missing leaf blocks.
The bug was caused because gfs2_edit was treating the directory leaf index (known as the directory hash table) like it did a normal data file. In other words, a collection of metadata blocks. For a normal data file gfs2_edit needs to save only the metadata blocks, but not the user's data blocks. For a directory, gfs2_edit needs to save the "data" because the "data" blocks are the actual
directory hash table, and the blocks beneath it are the directory leaf blocks that also need to be saved.
The fix was to change gfs2_edit's savemeta function to actually read all the data (i.e. the directory hash table) for large directories and traverse the hash table, saving all the leaf blocks.
With the directory hash table processed properly, all leaf blocks are saved properly.
The original commit landed at the wrong time and I had to revert/reapply.
New sha1 is: 258fd452647c6210e68f9528c723e3a49d77dbfa
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.