Red Hat Bugzilla – Bug 1201238
xfs_repair verify the last secondary superblock corruption failed
Last modified: 2015-11-19 08:51:13 EST
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:
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?
Fixed in xfsprogs-3.2.2-1.el7
xfs/070 test passed on xfsprogs-3.2.2-2.el7.
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