Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1107238

Summary: gfs2_edit: print revoke continuation records for journals
Product: Red Hat Enterprise Linux 7 Reporter: Robert Peterson <rpeterso>
Component: gfs2-utilsAssignee: Robert Peterson <rpeterso>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.0CC: adas, anprice, bmarzins, cluster-maint, pevans, swhiteho
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gfs2-utils-3.1.7-1.el7 Doc Type: Enhancement
Doc Text:
Feature: gfs2_edit now prints journal revoke continuation records as part of its journal printing function. Reason: It was difficult to analyze the state of a journal containing revoke continuation records for debugging. Result: GFS2 journals can now be analyzed more thoroughly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 09:26:48 UTC Type: Bug
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: 1112342    
Bug Blocks:    
Attachments:
Description Flags
Proposed RHEL7 patch none

Description Robert Peterson 2014-06-09 20:38:58 UTC
Description of problem:
I tried to print the journals for a customer's metadata
with this command:

gfs2_edit -p journal0 /dev/sasdrives/scratch > /tmp/j0

When I examined the results carefully, I noticed that the
revoke continuation blocks (of metadata type GFS2_METATYPE_LB)
were not printed. The blocks were apparently skipped by
gfs2_edit altogether.

Version-Release number of selected component (if applicable):
RHEL7 (I suspect all releases)

How reproducible:
Always

Steps to Reproduce:
1. Create a somewhat big file in GFS2, e.g. 27GB
2. Delete the big file to get a bunch of revokes
3. umount
4. gfs2_edit -p journal0 /dev/your/device > /tmp/j0

Actual results:
The resulting file, /tmp/j0 will have revoke blocks printed
in its output. For example, things like this:
0x3af1 (j+3a96): Log descriptor, type 301 (Revoke) len:23, data1: 11274
But since a revoke block in the journal can hold at most 503
block pointers, there should be log buffer blocks immediately
following the revoke block. If you look at the block following
the revoke, in hex mode, you see something like this:
Block #15090    (0x3af2) of 183500800 (0xaf00000) (log buffer)
(p.1 of 4--Data )
03af2000 01161970 0000000c 00000000 00000000 [...p............] lb_header.mh_magic
03af2010 000003e8 00000000 
but this log buffer block is not printed in the /tmp/j0 file.

Expected results:
The log buffer blocks (revoke continuations) should be printed
in the /tmp/j0 output file.

Additional info:
I suspect this is a new bug, and it exists in all releases, so
we'll have to decide whether to back-port the patch (when we have
it) to other releases.

Comment 2 Andrew Price 2014-06-10 00:27:28 UTC
The missed continuation blocks were all of type GFS2_METATYPE_LB and this patch gets them to print. The output could be improved on though, so feel free to modify it to your taste. (It's against upstream but will probably apply to RHEL7 too, at least.)

diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c
index e012bc3..58e51a0 100644
--- a/gfs2/edit/journal.c
+++ b/gfs2/edit/journal.c
@@ -582,7 +582,7 @@ void dump_journal(const char *journal, int tblk)
                                           " [UNMOUNTED]" : "");
                        }
                        eol(0);
-               } else if (sbd.gfs1 && ld_blocks > 0) {
+               } else if ((sbd.gfs1 && ld_blocks > 0) || block_type == GFS2_METATYPE_LB) {
                        print_gfs2("0x%llx (j+%4llx): GFS log descriptor"
                                   " continuation block", abs_block, jb);
                        eol(0);

Comment 3 Robert Peterson 2014-06-10 16:38:05 UTC
Created attachment 907327 [details]
Proposed RHEL7 patch

This patch seems to work nicely.

Comment 4 Andrew Price 2014-06-10 17:03:31 UTC
(In reply to Robert Peterson from comment #3)
> Created attachment 907327 [details]
> Proposed RHEL7 patch
> 
> This patch seems to work nicely.

I applied the patch (to upstream master), gave it a test and it looks good. The logic of the conditional makes more sense this way. Just a minor nit that the D in "descriptor" probably shouldn't be capitalized :)

Comment 5 Robert Peterson 2014-06-17 13:44:01 UTC
Notes for QE:

# gfs2_edit restoremeta /home/bob/metadata/gfs2/savemetafile.meta.1026911.gz /dev/sasdrives/scratch

Without the patch:

# /sbin/gfs2_edit -p journal0 /dev/sasdrives/scratch | grep "continuation block" | wc -l
0

If the problem is fixed:
# /sbin/gfs2_edit -p journal0 /dev/sasdrives/scratch | grep "continuation block" | wc -l
71

Alternatively, you could devise a test that does a boat-load of
metadata manipulation such that at least one transaction has
more metadata blocks than will fit in a log descriptor. You need
504 metadata blocks or more for a single transaction. That will
create the necessary continuation blocks.

Requesting qa_ack.

Comment 6 Robert Peterson 2014-07-24 13:37:23 UTC
Adding this feature to gfs2_edit is not a trivial matter. The
upstream patch doesn't apply directly because a lot of work was
done in the journal dumping code. All the journal dumping code
was separated out into its own source file, journal.c.
Here is a comprehensive list of commits I intend to push for
this bug:

-----------------------[ RHEL7.bob5 ]-----------------------
244856d gfs2_edit: Separate out the journal-related functions to journal.c
018cc79 gfs2_edit: Add more intelligence to journal dumps
a5a2ab2 gfs2_edit: Use the metadata description in get_block_type
6af44f9 gfs2_edit: Report referencing block address in the new journal code
9fb49f8 gfs2_edit: More static analysis fixes
7f198fc gfs2_edit: Corrections to log descriptor reference parsing
1adb7d6 gfs2_edit: mark log headers with the unmounted flag
9739f5b gfs2_edit: print LB (log descriptor continuation blocks) for GFS2
073cd78 gfs2_edit: Print block types with log descriptors

In reality, it shouldn't matter much, because we're planning to
rebase gfs2-utils for RHEL7 from the upstream anyway. So I'm
assuming this is okay. I tested all these on system gfs-i24c-01.

Comment 9 Nate Straz 2014-11-05 20:28:32 UTC
Before fix:

[root@host-053 ~]# rpm -q gfs2-utils
gfs2-utils-3.1.6-13.el7.x86_64

[root@host-053 ~]# mkfs -t gfs2 -O -p lock_nolock -j 1 /dev/sda1
It appears to contain an existing filesystem (gfs2)
This will destroy any data on /dev/sda1
Device:                    /dev/sda1
Block size:                4096
Device size:               100.00 GB (26214055 blocks)
Filesystem size:           100.00 GB (26214054 blocks)
Journals:                  1
Resource groups:           400
Locking protocol:          "lock_nolock"
Lock table:                ""
UUID:                      c54c72ca-6b02-a9a1-2963-15f318cb4bbf
[root@host-053 ~]# mount /dev/sda1 /mnt
[root@host-053 ~]# dd if=/dev/zero of=/mnt/filler bs=1M count=30000
30000+0 records in
30000+0 records out
31457280000 bytes (31 GB) copied, 188.249 s, 167 MB/s
[root@host-053 ~]# sync
[root@host-053 ~]# rm /mnt/filler
rm: remove regular file ‘/mnt/filler’? y
[root@host-053 ~]# umount /mnt
[root@host-053 ~]# gfs2_edit -p journal0 /dev/sda1 > /tKtmp/j0.txt
[root@host-053 ~]# grep -c "continuation block" /tmp/j0.txt
0

After fix:
[root@host-050 ~]# rpm -q gfs2-utils
gfs2-utils-3.1.7-1.el7.x86_64
[root@host-050 ~]# mkfs -t gfs2 -p lock_nolock -j 1 -O /dev/sda
It appears to contain an existing filesystem (gfs2)
This will destroy any data on /dev/sda
Device:                    /dev/sda
Block size:                4096
Device size:               100.00 GB (26214400 blocks)
Filesystem size:           100.00 GB (26214398 blocks)
Journals:                  1
Resource groups:           51
Locking protocol:          "lock_nolock"
Lock table:                ""
UUID:                      b88d8568-baaa-7e96-119c-f31059b7d2d7
[root@host-050 ~]# mount /dev/sda /mnt
[root@host-050 ~]# dd if=/dev/zero of=/mnt/filler bs=1M count=30000
30000+0 records in
30000+0 records out
31457280000 bytes (31 GB) copied, 201.421 s, 156 MB/s
[root@host-050 ~]# sync
[root@host-050 ~]# rm /mnt/filler
rm: remove regular file ‘/mnt/filler’? y
[root@host-050 ~]# umount /mnt
[root@host-050 ~]# gfs2_edit -p journal0 /dev/sda > ?tmpK/tmp/j0.xKtxt
[root@host-050 ~]# grep -c "continuation block" /tmp/j0.txt
29

Comment 11 errata-xmlrpc 2015-03-05 09:26:48 UTC
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.

https://rhn.redhat.com/errata/RHBA-2015-0428.html