Bug 502056

Summary: GFS2: gfs2_edit savemeta needs to save freemeta blocks
Product: Red Hat Enterprise Linux 5 Reporter: Robert Peterson <rpeterso>
Component: gfs2-utilsAssignee: Robert Peterson <rpeterso>
Status: CLOSED ERRATA QA Contact: Martin Banas <mbanas>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.3CC: adas, bmarzins, cfeist, edamato, mbanas, swhiteho, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: gfs2-utils-0.1.58-1.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-02 11:02:25 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:
Attachments:
Description Flags
Patch to fix the problem none

Description Robert Peterson 2009-05-21 16:54:13 UTC
Description of problem:
The gfs2_edit savemeta function currently does not save off
blocks of type 2, which correspond to "free metadata" in gfs and
"unlinked dinodes" in gfs2.  This turns out to be a problem because
if that metadata is restored and gfs is tested against it, it will
result in metadata allocation problems.  For example, gfs_grow may
make the decision to allocate a metadata block, and try to re-use a
block that's marked as "free metadata" in the gfs bitmap.  But
since the block wasn't saved at "savemeta" time, the block was
never restored as metadata and therefore the metadata header may
be missing, so gfs-kernel will throw a file system error.

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

How reproducible:
Always

Steps to Reproduce:
I haven't actually tried this, but this should theoretically do it:

lvcreate -L 95G -n data roth_vg
mkfs -t gfs -j 1 -t "bobs_roth:data" -p lock_nolock -O /dev/roth_vg/data
mount -tgfs /dev/roth_vg/data /mnt/gfs
for i in `seq 1 1000` ; do cp /etc/fstab /mnt/gfs/f$i ; done
sync
rm /mnt/gfs/f*
umount /mnt/gfs
gfs2_edit savemeta /dev/roth_vg/data /tmp/bob.metasave
dd if=/dev/zero of=/dev/roth_vg/data
gfs2_edit restoremeta /tmp/bob.metasave /dev/roth_vg/data
mount -tgfs /dev/roth_vg/data /mnt/gfs
lvresize -L +200G /dev/roth_vg/data
gfs_grow /mnt/gfs
  
Actual results:

GFS: fsid=bobs_roth:data.0: fatal: invalid metadata block
GFS: fsid=bobs_roth:data.0:   bh = 62327 (magic)
GFS: fsid=bobs_roth:data.0:   function = gfs_trans_add_bh
GFS: fsid=bobs_roth:data.0:   file = /home/bob/cluster/gfs-kernel/src/gfs/trans.c, line = 290
GFS: fsid=bobs_roth:data.0:   time = 1242916713
GFS: fsid=bobs_roth:data.0: about to withdraw from the cluster
GFS: fsid=bobs_roth:data.0: telling LM to withdraw
GFS: fsid=bobs_roth:data.0: withdrawn

Expected results:
gfs_grow should work just fine.

Additional info:
I have a working patch to fix the problem.
Very low risk because gfs2_edit is only used for debugging file system
problems.

Comment 1 Robert Peterson 2009-05-21 19:48:24 UTC
Created attachment 345017 [details]
Patch to fix the problem

Comment 2 Robert Peterson 2009-05-21 19:50:26 UTC
The patch has been pushed to the master branch of the gfs2-utils
repository and the STABLE2, STABLE3 and RHEL5 branches of the
cluster git repository for inclusion into RHEL5.  It was tested on
system roth-01.  Changing status to Modified.

Comment 5 Martin Banas 2009-07-24 09:30:42 UTC
Retested with RHEL5.4-Server-20090722.0 and gfs2-utils-0.1.61-1.el5.

gfs_grow worked OK, no error displayed, successfull grow of filesystem.

Moving the bug to VERIFIED state.

Comment 7 errata-xmlrpc 2009-09-02 11:02:25 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/RHSA-2009-1337.html