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 1165285

Summary: Corrupt system jindex confuses fsck.gfs2
Product: Red Hat Enterprise Linux 7 Reporter: Robert Peterson <rpeterso>
Component: gfs2-utilsAssignee: Robert Peterson <rpeterso>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.2CC: cluster-maint, gfs2-maint, jpayne
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gfs2-utils-3.1.8-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 03:53:00 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: 1153316, 1184482, 1268045    
Bug Blocks:    
Attachments:
Description Flags
Early prototype #1
none
Patch 1 of 2 - Rebuild system files if they don't have the SYS bit set
none
Patch 2 of 2 - Check the integrity of the journal index none

Description Robert Peterson 2014-11-18 18:16:10 UTC
Description of problem:
If you have a file system with a corrupt jindex file, it
confuses fsck.gfs2, which doesn't entirely fix things.

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

How reproducible:
Always

Steps to Reproduce:
1. gfs2_edit restoremeta /home/bob/metadata/gfs2/dirty/saswork.banjaxedjindex.meta /dev/clariion_lun10/scratch
2. fsck.gfs2 -y /dev/clariion_lun10/scratch &> /tmp/gronk
3. echo $?
4. fsck.gfs2 /dev/clariion_lun10/scratch

Actual results:
[root@gfs-i24c-01 /home/bob]# gfs2_edit restoremeta /home/bob/metadata/gfs2/dirty/saswork.banjaxedjindex.meta /dev/clariion_lun10/scratch
No valid file header found. Falling back to old format...
Block size is 4096B
This is gfs2 metadata.
There are 1073741824 free blocks on the destination device.
Highest saved block is 268410886 (0xfffa006)
268410887 blocks processed, 26462 saved (100%)
File /home/bob/metadata/gfs2/dirty/saswork.banjaxedjindex.meta restore successful.
[root@gfs-i24c-01 /home/bob]# fsck.gfs2 -y /dev/clariion_lun10/scratch &> /tmp/gronk
[root@gfs-i24c-01 /home/bob]# echo $?
1
[root@gfs-i24c-01 /home/bob]# fsck.gfs2 /dev/clariion_lun10/scratch
Initializing fsck
The gfs2 system jindex inode is missing. Okay to rebuild it? (y/n) 

Expected results:
The second run of fsck.gfs2 should be clean, $? should be 0.

Additional info:

Comment 1 Robert Peterson 2014-11-18 18:17:31 UTC
Assigning to Andy for now, but I'm happy to assist.

Comment 4 Robert Peterson 2015-01-09 15:31:47 UTC
Reassigning to me because I'm already making major changes to fsck.gfs2.

Comment 5 Robert Peterson 2015-01-09 19:39:55 UTC
Created attachment 978377 [details]
Early prototype #1

This patch seems to work; needs more testing.

Comment 6 Robert Peterson 2015-02-12 20:50:49 UTC
Created attachment 991144 [details]
Patch 1 of 2 - Rebuild system files if they don't have the SYS bit set

Here is patch 1 of 2 to fix this problem.

Comment 7 Robert Peterson 2015-02-12 20:53:21 UTC
Created attachment 991145 [details]
Patch 2 of 2 - Check the integrity of the journal index

This is patch 2 of 2 for this bug. It checks the integrity of
the system jindex file, and performs repairs as needed.

Comment 8 Robert Peterson 2015-02-13 14:44:12 UTC
These two patches are in the master branch of the upstream
gfs2-utils git repo, since 22 January 2015. So it's just a
matter of pushing them to the RHEL7 branch at this point.
However, they do rely upon the existence of the patches for
bug #1153316, so I'm going to add that as a dependency.

Comment 12 Justin Payne 2015-08-11 15:32:02 UTC
Verified in gfs2-utils-3.1.8-4.el7:

[root@dash-01 ~]# rpm -q gfs2-utils 
gfs2-utils-3.1.8-4.el7.x86_64
[root@dash-01 ~]# gfs2_edit restoremeta saswork.banjaxedjindex.meta /dev/mapper/fsck-sasdata 
No valid file header found. Falling back to old format...
Block size is 4096B
This is gfs2 metadata.
There are 805306368 free blocks on the destination device.
Highest saved block is 268410886 (0xfffa006)
268410887 blocks processed, 26462 saved (100%)
File saswork.banjaxedjindex.meta restore successful.
[root@dash-01 ~]# fsck.gfs2 -y /dev/mapper/fsck-sasdata &> /tmp/fsck_out
[root@dash-01 ~]# echo $?
1
[root@dash-01 ~]# fsck.gfs2 /dev/mapper/fsck-sasdata 
Initializing fsck
Validating Resource Group index.
Level 1 rgrp check: Checking if all rgrp and rindex values are good.
(level 1 passed)
Starting pass1
pass1 completed in 0.144s
Starting pass1b
pass1b completed in 0.000s
Starting pass1c
pass1c completed in 0.000s
Starting pass2
pass2 completed in 1.267s
Starting pass3
pass3 completed in 0.000s
Starting pass4
pass4 completed in 0.000s
Starting pass5
pass5 completed in 1.456s
Starting check_statfs
check_statfs completed in 0.000s
gfs2_fsck complete
[root@dash-01 ~]# echo $?
0

Comment 14 errata-xmlrpc 2015-11-19 03:53:00 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-2178.html