Bug 483799 - GFS2: gfs2_edit fixes for 5.4
GFS2: gfs2_edit fixes for 5.4
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gfs2-utils (Show other bugs)
All Linux
low Severity low
: rc
: ---
Assigned To: Robert Peterson
Cluster QE
Depends On:
  Show dependency treegraph
Reported: 2009-02-03 12:27 EST by Robert Peterson
Modified: 2010-01-11 22:42 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-09-02 07:02:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
First patch (34.22 KB, patch)
2009-02-05 15:17 EST, Robert Peterson
no flags Details | Diff
Second patch (44.89 KB, patch)
2009-02-10 16:33 EST, Robert Peterson
no flags Details | Diff
Latest RHEL5 patch (61.16 KB, patch)
2009-02-17 12:18 EST, Robert Peterson
no flags Details | Diff
Latest upstream patch (52.86 KB, patch)
2009-02-17 12:18 EST, Robert Peterson
no flags Details | Diff

  None (edit)
Description Robert Peterson 2009-02-03 12:27:40 EST
Description of problem:
This bugzilla is for adding new capabilities to the gfs2_edit tool
that will help us in testing and debugging gfs and gfs2 issues.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Actual results:

Expected results:

Additional info:
Some enhancements I've considered doing are:

1. The ability for gfs2_edit to report on whether a given block is
   free, allocated data, or allocated metadata or reusable metadata.
2. The ability for gfs2_edit to edit the file system through the
   command line (For example, to inject problems to test gfs2_fsck
   error conditions).  This would be very useful for the QE team to
   automate test cases.
3. The ability to search for blocks of a given metadata type, which
   is useful for digging through journals looking for evidence of
   something that's gone wrong.
4. The ability to highlight a desired pointer so it may be easily
   parsed by the human eye when looking for a corrupt reference.
5. The ability to edit fields in structure mode.  (Right now, only
   hex mode allows you to edit).
Comment 1 Robert Peterson 2009-02-05 15:17:30 EST
Created attachment 331049 [details]
First patch

This RHEL5 patch adds some of the functionality described.  
Here is some sample output:

[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p 0x8000 blocktype /dev/roth_vg/roth_lv 
8 (Block 32768 is type 8: Log Header)
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p 25 blocktype /dev/roth_vg/roth_lv 
4 (Block 25 is type 4: Dinode)
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p 25 blockalloc /dev/roth_vg/roth_lv 
3 (Metadata)
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p 25 blockalloc 1 /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p 25 blockalloc /dev/roth_vg/roth_lv 
1 (Data)
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p 25 blockalloc 3 /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p 25 blockalloc /dev/roth_vg/roth_lv 
3 (Metadata)
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p 25 field di_size /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p 25 field di_size /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p 25 field di_size 0x4300 /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p 25 field di_size /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p 0x11000 blockrg /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p rg 1 /dev/roth_vg/roth_lv 
RG #1 located at: 65555 (0x10013)
  mh_magic              0x01161970(hex)
  mh_type               2                   0x2
  mh_format             200                 0xc8
  rg_flags              0                   0x0
  rg_free               65528               0xfff8
  rg_dinodes            0                   0x0
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p 0x27017 blockbits /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p 0x21017 blockbits /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p 0x28017 blockbits /dev/roth_vg/roth_lv 
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p 0x28017 blockrg /dev/roth_vg/roth_lv 
Comment 2 Robert Peterson 2009-02-10 16:33:44 EST
Created attachment 331475 [details]
Second patch

This patch adds all of the functionality I described above, except
it does not highlight fields.  This one adds the metadata find feature
for both -p and interactive mode.  Example output:

[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p 0 find none /dev/roth_vg/roth_lv
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -p rg 0 find di /dev/roth_vg/roth_lv
[root@roth-01 ../gfs2/edit]# ./gfs2_edit -x -p rg 0 find rg /dev/roth_vg/roth_lv
Comment 3 Robert Peterson 2009-02-17 12:18:13 EST
Created attachment 332259 [details]
Latest RHEL5 patch

This patch allows gfs2_edit to print on the interactive screen whether
the block is free, data, metadata, unlinked, or reserved (==metadata not
associated with bitmaps, like the RG space, bitmaps and superblock).
Also, I fixed a bug whereby "-p size" would also try to dump block info.
Also, I ported some relatively minor upstream fixes back to RHEL5.
Comment 4 Robert Peterson 2009-02-17 12:18:55 EST
Created attachment 332260 [details]
Latest upstream patch

This is the upstream version of the patch
Comment 5 Robert Peterson 2009-02-17 13:22:11 EST
I made one minor correction to the above patches, then committed them
to the master branch of the gfs2-utils git tree, and the RHEL5
branch of the cluster git tree for inclusion into 5.4.  The patch was
tested on system roth-01.  Changing status to MODIFIED.
Comment 6 Robert Peterson 2009-03-25 11:05:11 EDT
Changing status temporarily back to assigned because I have one more
improvement to gfs2_edit to slip in.  This patch does basically two
things to improve debugging of indirect pointer problems such as
bug #490136 (for which I developed it).  First, I improved the color
scheme and made it differentiate zero-data from non-zero data for
some metadata block types.  This allows you to easily see where a
pointer is located on the screen rather than staring into a sea of
zeroes.  Second, I made gfs2_edit tell you what pointer number your
cursor is at for dinodes and indirect blocks.  That way, you can
easily check your metapath information against what's on disk.
I transposed the "red" and "pink" sections so that the cursor is red
and therefore easier to see.  This may all be lumped into item number
4 from the problem description above, which is the only fix I had not
included with the previous commits.
Comment 7 Robert Peterson 2009-03-25 11:10:45 EDT
The additional patch has been pushed to the RHEL5 branch for inclusion
into 5.4.  Changing status back to Modified.
Comment 11 errata-xmlrpc 2009-09-02 07:02:47 EDT
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.


Note You need to log in before you can comment on or make changes to this bug.