Bug 679565

Summary: gfs2_edit savemeta doesn't save all leaf blocks for large dirs
Product: Red Hat Enterprise Linux 5 Reporter: Robert Peterson <rpeterso>
Component: gfs2-utilsAssignee: Robert Peterson <rpeterso>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: medium    
Version: 5.7CC: adas, djansa, edamato, fnadge, mjuricek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gfs2-utils-0.1.62-30.el5 Doc Type: Bug Fix
Doc Text:
Cause 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. Consequence 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. Fix 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. Result With the directory hash table processed properly, all leaf blocks are saved properly.
Story Points: ---
Clone Of:
: 679566 (view as bug list) Environment:
Last Closed: 2011-07-21 11:10:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 679566    
Attachments:
Description Flags
Patch to fix the problem
none
Better version of the patch none

Description Robert Peterson 2011-02-22 21:20:43 UTC
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):
RHEL56

How reproducible:
Always

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
  
Actual results:
0

Expected results:
10214


Additional info:
Patch in hand

Comment 1 Robert Peterson 2011-02-22 21:22:25 UTC
Requesting ack flags for 5.7.

Comment 2 Robert Peterson 2011-02-22 21:36:32 UTC
Created attachment 480259 [details]
Patch to fix the problem

Tested on roth-01

Comment 3 Robert Peterson 2011-02-23 13:29:47 UTC
The patch was pushed upstream to the master branch of the
gfs2-utils git repo.  It was tested on my F14 desktop.

Comment 4 Robert Peterson 2011-03-16 17:37:38 UTC
Created attachment 485801 [details]
Better version of the patch

Comment 5 Robert Peterson 2011-03-16 18:18:12 UTC
The latest patch has been pushed to the RHEL57 branch of the
cluster.git repository for inclusion into 5.7.  Changing status
to POST until this gets built.

Comment 7 Martin Juricek 2011-05-23 15:59:14 UTC
Verified with package gfs2-utils-0.1.62-30.el5, kernel 2.6.18-261.el5

Comment 9 Florian Nadge 2011-05-24 14:25:38 UTC
    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.
    
    New Contents:
This field is the basis of the errata or release note for this bug. It can also be used for change logs.

The Technical Note template, known as CCFR, is as follows:

Cause
    What actions or circumstances cause this bug to present.
Consequence
    What happens when the bug presents.
Fix
    What was done to fix the bug.
Result
    What now happens when the actions or circumstances above occur.
    Note: this is not the same as the bug doesn’t present anymore.

Comment 10 Robert Peterson 2011-05-24 18:48:36 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,13 +1,12 @@
-This field is the basis of the errata or release note for this bug. It can also be used for change logs.
-
-The Technical Note template, known as CCFR, is as follows:
-
 Cause
-    What actions or circumstances cause this bug to present.
+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.
+
 Consequence
-    What happens when the bug presents.
+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.
+
 Fix
-    What was done to fix the bug.
+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.
+
 Result
-    What now happens when the actions or circumstances above occur.
+With the directory hash table processed properly, all leaf blocks are saved properly.-    Note: this is not the same as the bug doesn’t present anymore.

Comment 11 errata-xmlrpc 2011-07-21 11:10:17 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1042.html