Bug 506343 - gfs2_edit -p block# shows wrong height/offset on gfs1 and segfaults on gfs2
gfs2_edit -p block# shows wrong height/offset on gfs1 and segfaults on gfs2
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gfs2-utils (Show other bugs)
5.4
All Linux
low Severity medium
: rc
: ---
Assigned To: Robert Peterson
Cluster QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-16 15:11 EDT by Jaroslav Kortus
Modified: 2010-03-30 04:54 EDT (History)
1 user (show)

See Also:
Fixed In Version: gfs2-utils-0.1.62-4.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-30 04:54:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to fix the problem (8.92 KB, patch)
2009-08-18 17:29 EDT, Robert Peterson
no flags Details | Diff
Revised patch (10.55 KB, patch)
2009-09-01 17:34 EDT, Robert Peterson
no flags Details | Diff

  None (edit)
Description Jaroslav Kortus 2009-06-16 15:11:57 EDT
Description of problem:
gfs2_edit -p block# should print the content of the block. It does so until you hit last block of links (pointing directly to data). This scenario causes gfs2_edit print wrong height and some nonsense as data offset on GFS1 filesystem. Same scenario on GFS2 filesystem ends with segmentation fault.

Version-Release number of selected component (if applicable):
gfs2_edit version 0.1.58 (built May 29 2009 15:43:58)
gfs-utils-0.1.19-3.el5
gfs2-utils-0.1.58-1.el5
kmod-gfs-0.1.33-2.el5

How reproducible:
always

Steps to Reproduce:
1. mkfs.gfs -O -t a3cluster:a3gfs2 -p lock_nolock -j 2 -J 32 ${DEVICE}
or
1. mkfs.gfs2 -O -t a3cluster:a3gfs2 -p lock_nolock -j 2 -J 8 ${DEVICE}
2. mount and create 10M file (yes | head -c 10000000 > file-01)
3. use gfs2_edit to walk through the filesystem and walk through the created file. Every time you change block# in the interactive editor, try "gfs2_edit -p block# ${DEVICE}" with the same block# as you see in the header of the editor.
4. at last page the height will be different and data offset will be a nonsense
  
Actual results:
different values for different usage of gfs2_edit

Expected results:
values are the same, utility does not crash

Additional info:

GFS1 (1G filesystem, 10M file):
gfs2_edit -p '35' /dev/GFSVG/GFS
Block #35    (0x23) of 262144 (0x40000) (indir blklist)

Indirect Block:
  mh_magic              0x01161970(hex)
  mh_type               5                   0x5
  mh_format             500                 0x1f4

This indirect block contains 1 indirect blocks
  (at height=2)
Indirect blocks:
0 => 0x9e2 / 2530     (data offset 0x57ff500000000000 / 6340874761291169792 /   5.50E)   

GFS2:
segfault with:
Core was generated by `gfs2_edit -p 5143 /dev/GFSVG/GFS'.
Program terminated with signal 11, Segmentation fault.
[New process 28810]
#0  0x0000000000401fea in print_gfs2 (fmt=Cannot access memory at address 0x790a790a790a7732
) at gfs2hex.c:95
95      }
(gdb) bt full
#0  0x0000000000401fea in print_gfs2 (fmt=Cannot access memory at address 0x790a790a790a7732
) at gfs2hex.c:95
        args = Cannot access memory at address 0x790a790a790a783a

The address here seems like the data read from the data block (all "y")
Remark: it seems to work on ia64 for GFS1. For GFS2 the segfault occurs.
Comment 1 Robert Peterson 2009-06-23 10:37:28 EDT
I've known about this bug for a very long time.  It's in the gfs2
debugger tool, gfs2_edit, so low priority, but it should get fixed.
Requesting ack flags so we can fix it in RHEL5.5.
Comment 2 Robert Peterson 2009-08-18 17:29:09 EDT
Created attachment 357855 [details]
Patch to fix the problem

Although it's not real straightforward, this patch fixes the
problem for both interactive and print mode.  I haven't tested
heights > 2.
Comment 3 Robert Peterson 2009-09-01 17:34:57 EDT
Created attachment 359452 [details]
Revised patch

This patch fixes a bug I found while testing the previous patch.
Comment 4 Robert Peterson 2009-09-02 12:06:21 EDT
The patch was pushed to the master branch of the gfs2-utils git
repository and the STABLE3, STABLE2 and RHEL55 branches of the
cluster git repository for inclusion into 5.5.  Changing status
to POST while I do builds.

RHEL55:  90097fd
master:  7ad8cc8
STABLE3: 03a04c4
STABLE2: 9193f20
Comment 5 Robert Peterson 2009-09-02 12:34:06 EDT
Build complete and successful.  Changing status to Modified.
Comment 10 errata-xmlrpc 2010-03-30 04:54:01 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.

http://rhn.redhat.com/errata/RHBA-2010-0287.html

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