Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1201238 - xfs_repair verify the last secondary superblock corruption failed
xfs_repair verify the last secondary superblock corruption failed
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: xfsprogs (Show other bugs)
7.2
All Linux
medium Severity medium
: rc
: ---
Assigned To: Eric Sandeen
Zorro Lang
:
Depends On:
Blocks: 1205796
  Show dependency treegraph
 
Reported: 2015-03-12 07:54 EDT by Zorro Lang
Modified: 2015-11-19 08:51 EST (History)
3 users (show)

See Also:
Fixed In Version: xfsprogs-3.2.2-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-19 08:51:13 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2151 normal SHIPPED_LIVE Low: xfsprogs security, bug fix and enhancement update 2015-11-19 06:33:04 EST

  None (edit)
Description Zorro Lang 2015-03-12 07:54:34 EDT
Description of problem:
xfstests xfs/070 run failed on RHEL7.1. more details as below:

Version-Release number of selected component (if applicable):
kernel-3.10.0-231.el7
xfsprogs-3.2.1-6.el7

How reproducible:
xfstests xfs/070

or you can run these steps:
Steps to Reproduce:
1. mkfs.xfs /dev/sda2, got agcount (Eg: agcount=4)
2. xfs_db -x -c "sb $((agcount - 1))" -c "type data" -c "write fill 0xff 0 512" /dev/sda2
3. xfs_repair -n /dev/sda2

Actual results:
If you run xfs/070 case, you will get error messages likes:
----
Phase 1 - find and verify superblock...
couldn't verify primary superblock - bad magic number !!!

attempting to find secondary superblock...
............................................/tests/xfs/070: line 70:  5326 Broken pipe             $XFS_REPAIR_PROG $SCRATCH_DEV 2>&1
      5327 Killed                  | tee -a $seqres.full > $tmp.repair
xfs_repair resorted to brute force scan
----

Or if you run manually, you will got:
----
[root@hp-dc5800-01 xfsprogs-3.2.1]# xfs_repair -n /dev/sda2
Phase 1 - find and verify superblock...
couldn't verify primary superblock - bad magic number !!!

attempting to find secondary superblock...
.......................found candidate secondary superblock...
error reading superblock 1 -- seek to offset 312478593024 failed
unable to verify superblock, continuing...
...........................found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
error reading superblock 1 -- seek to offset 17179869184 failed
unable to verify superblock, continuing...
found candidate secondary superblock...
superblock read failed, offset 16106127360, size 131072, ag 960, rval 0

fatal error -- Invalid argument
----

Expected results:
xfs/070 run pass

Additional info:
Comment 1 Zorro Lang 2015-03-12 08:08:46 EDT
I tried this xfsprogs upstream commit 6d23d9a5dad9003d3b4e8e970c393f90a137d10d from Bian Foster.
diff --git a/repair/sb.c b/repair/sb.c
index ad27756..dc154f7 100644
--- a/repair/sb.c
+++ b/repair/sb.c
@@ -724,7 +724,6 @@ verify_set_primary_sb(xfs_sb_t              *rsb,
         * sector size rather than the sector size in @rsb.
         */
        size = NUM_AGH_SECTS * (1 << (XFS_MAX_SECTORSIZE_LOG));
-       retval = 0;
        list = NULL;
        num_ok = 0;
        *sb_modified = 0;
@@ -779,6 +778,7 @@ verify_set_primary_sb(xfs_sb_t              *rsb,
        /*
         * see if we have enough superblocks to bother with
         */
+       retval = 0;
        if (num_ok < num_sbs / 2) {
                retval = XR_INSUFF_SEC_SB;
                goto out_free_list;
@@ -868,5 +868,5 @@ out_free_list:
        free_geo(list);
        free(sb);
        free(checked);
-       return(retval);
+       return retval;
 }

It looks good, after patch it and run xfs/070 again. I got this new output:
----
[root@hp-dc5800-01 xfstests]# less /var/lib/xfstests/results/xfs/xfs-070.full
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
bad magic number
bad on-disk superblock 3 - bad magic number
primary/secondary superblock 3 conflict - AG superblock geometry info conflicts with filesystem geometry
zeroing unused portion of secondary superblock (AG #3)
non-null project quota inode field in superblock 3
reset bad sb for ag 3
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
Phase 5 - rebuild AG headers and trees...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done
----

That's nearly same with expected result, except one line is un-expected:
"non-null project quota inode field in superblock AGNO" in Phase 2.

I can't sure if this line is a bug?
Comment 4 Eric Sandeen 2015-06-15 16:43:58 EDT
Fixed in xfsprogs-3.2.2-1.el7
Comment 6 Zorro Lang 2015-10-08 02:10:45 EDT
xfs/070 test passed on xfsprogs-3.2.2-2.el7.
Comment 7 errata-xmlrpc 2015-11-19 08:51:13 EST
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/RHSA-2015-2151.html

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