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 1154726

Summary: GFS2: fsck.gfs2 pass2 is reading inodes twice
Product: Red Hat Enterprise Linux 7 Reporter: Nate Straz <nstraz>
Component: gfs2-utilsAssignee: Andrew Price <anprice>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: cluster-maint, gfs2-maint, swhiteho
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:52:50 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: 1184482    
Bug Blocks: 1111393, 1497636    
Attachments:
Description Flags
Patch posted upstream none

Description Nate Straz 2014-10-20 15:42:54 UTC
Description of problem:

While waiting for a 100TB file system fsck I pulled some strace samples during pass2 and found that inodes were being read twice, consecutively.

preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10m"..., 4096}], 1, 100874726567936) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10m"..., 4096}], 1, 100874726567936) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10o"..., 4096}], 1, 100874726666240) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10o"..., 4096}], 1, 100874726666240) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10q"..., 4096}], 1, 100874726785024) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10q"..., 4096}], 1, 100874726785024) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10s"..., 4096}], 1, 100874726924288) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10s"..., 4096}], 1, 100874726924288) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10u"..., 4096}], 1, 100874727014400) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10u"..., 4096}], 1, 100874727014400) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10w"..., 4096}], 1, 100874727170048) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10w"..., 4096}], 1, 100874727170048) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10y"..., 4096}], 1, 100874727473152) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\4\0\0\0\0\0\0\10y"..., 4096}], 1, 100874727473152) = 4096


Version-Release number of selected component (if applicable):
gfs2-utils-3.1.7-1.el7.x86_64

How reproducible:
Easily

Steps to Reproduce:
1. Create a lot of files on a GFS2 file system
2. Run fsck.gfs2

Actual results:


Expected results:


Additional info:

Comment 2 Steve Whitehouse 2015-02-09 14:31:12 UTC
One that we really need to have fixed for 7.2

Comment 3 Andrew Price 2015-02-26 18:33:07 UTC
The pairs are due to these two paths, both originating in the pass2() function:

#2  0x000000000040cb83 in fsck_load_inode (sdp=0x7fffffffdc10, block=229964) at metawalk.c:244
#3  0x00000000004107e9 in check_dir (sdp=0x7fffffffdc10, block=229964, pass=0x649800 <pass2_fxns>) at metawalk.c:1706
#4  0x000000000041e478 in pass2 (sdp=0x7fffffffdc10) at pass2.c:1907

and shortly after:

#2  0x000000000040cb83 in fsck_load_inode (sdp=0x7fffffffdc10, block=229964) at metawalk.c:244
#3  0x000000000041e717 in pass2 (sdp=0x7fffffffdc10) at pass2.c:1956

The inode is thrown away before check_dir() returns, which is why the second fsck_load_inode() is happening. I'll look into changing check_dir() to accept an inode instead of loading it, and load it earlier in pass2().

Comment 4 Andrew Price 2015-03-04 17:42:10 UTC
Created attachment 997988 [details]
Patch posted upstream

This patch removes the duplicate read and adds failure checking for the remaining one. Note that, as the inode block is cached when the second read happens, this patch doesn't give a noticeable performance increase, although reducing the duplication is worthwhile.

Comment 6 Andrew Price 2015-03-18 12:43:40 UTC
The above patch has been pushed upstream and will be picked up by the rebase.

Comment 9 Nate Straz 2015-08-17 19:01:44 UTC
Verified with gfs2-utils-3.1.8-4.el7.x86_64

I created a file system w/ 500k files and ran fsck.gfs2 on it.  After removing everything from the log besides pass2 I found no duplicate inode reads.


[root@host-050 sts-rhel7.2]# grep preadv /tmp/fsck-strace.log | grep '\\1\\26\\31p\\0\\0\\0\\4'
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\0\0\0\0\0\0\0\0\5"..., 4096}], 1, 134598656) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\0\0\0\0\0\0\0\0\6"..., 4096}], 1, 134602752) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\0\0\0\0\0\0\0\0\7"..., 4096}], 1, 134606848) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\0\0\0\0\0\0\0\0\1"..., 4096}], 1, 3531337728) = 4096
preadv(4, [{"\1\26\31p\0\0\0\4\0\0\0\0\0\0\0\0\0\0\1\220\0\0\0\0\0\0\0\0\0\0\0\1"..., 4096}], 1, 4576481280) = 4096

Comment 11 errata-xmlrpc 2015-11-19 03:52:50 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