Bug 474705 - GFS2: make gfs2_fsck conform to fsck(8) exit codes
GFS2: make gfs2_fsck conform to fsck(8) exit codes
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gfs2-utils (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Robert Peterson
Cluster QE
Depends On:
  Show dependency treegraph
Reported: 2008-12-04 16:58 EST by Nate Straz
Modified: 2010-01-11 22:41 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-09-02 07:02:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to fix the problem (30.70 KB, patch)
2009-02-10 18:11 EST, Robert Peterson
no flags Details | Diff
Script to test the fix (3.00 KB, text/plain)
2009-02-10 18:23 EST, Robert Peterson
no flags Details
Upstream version of the proposed patch (30.97 KB, patch)
2009-02-12 15:32 EST, Robert Peterson
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:1337 normal SHIPPED_LIVE Low: gfs2-utils security and bug fix update 2009-09-01 06:41:56 EDT

  None (edit)
Description Nate Straz 2008-12-04 16:58:29 EST
Description of problem:

While testing out bug 471618 I found that gfs2_fsck returned 0 after it found errors in the file system, but was not allowed to correct them.  This should have resulted in gfs2_fsck returning non-zero.  gfs2_fsck needs to return exit codes which conform to those outlined in fsck(8)

       The exit code returned by fsck is the sum of the following conditions:
            0    - No errors
            1    - File system errors corrected
            2    - System should be rebooted
            4    - File system errors left uncorrected
            8    - Operational error
            16   - Usage or syntax error
            32   - Fsck canceled by user request
            128  - Shared library error

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

How reproducible:

Steps to Reproduce:
1. mkfs -t gfs -b 1024 -p lock_nolock -j 1 /dev/3T_volume
2. gfs2_convert /dev/3T_volume
3. fsck -t gfs2 -n /dev/3T_volume
Actual results:
Starting pass5
Ondisk and fsck bitmaps differ at block 137 (0x89) 
Ondisk status is 1 (Data) but FSCK thinks it should be 0 (Free)
Metadata type is 0 (free)
Bitmap at block 137 (0x89) left inconsistent
gfs2_fsck complete    
<pass name="gfs2_fsck" ... />

Expected results:
<fail name="gfs2_fsck" ... exitstatus="4"/>

Additional info:
Comment 1 Robert Peterson 2009-01-07 15:58:50 EST
Should be doable.
Comment 2 Robert Peterson 2009-02-10 18:11:55 EST
Created attachment 331496 [details]
Patch to fix the problem

This patch has been tested and found to be correct on system roth-01.
Comment 3 Robert Peterson 2009-02-10 18:23:36 EST
Created attachment 331499 [details]
Script to test the fix

This script tests that the proper return codes are being sent
back from gfs2_fsck under various conditions.  This script relies
upon new functions added to gfs2_edit for bug #483799.  The only
test that this script does not test is the return code caused by
interrupting the fsck.
Comment 4 Robert Peterson 2009-02-12 15:32:19 EST
Created attachment 331747 [details]
Upstream version of the proposed patch

This is the upstream patch I'm going to commit.
Comment 5 Robert Peterson 2009-02-12 17:54:40 EST
The upstream patch was committed (but I fixed two additional compiler
warnings) and pushed to the master branch of the gfs2-utils git tree.
The RHEL5 patch was pushed to the RHEL5 branch of the cluster.git tree
for inclusion into 5.4.  It was tested on system roth-01 using special
modifications to gfs2_edit for bug #483799.  Changing status to
Comment 9 errata-xmlrpc 2009-09-02 07:02:36 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.


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