]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
repair: only check secondary sb->sb_pquotino for v5 superblocks
authorBrian Foster <bfoster@redhat.com>
Sun, 12 Apr 2015 23:33:46 +0000 (09:33 +1000)
committerDave Chinner <david@fromorbit.com>
Sun, 12 Apr 2015 23:33:46 +0000 (09:33 +1000)
commitfa8fb25abab9f2579e21ae86fdbc685b329f848d
treee9317ecc4e900f842971592f195ea9ab1105a78d
parent9da36109f114bfee4ec98187fba32d9a0b9bc442
repair: only check secondary sb->sb_pquotino for v5 superblocks

xfs_repair scans for garbage data beyond the last valid superblock field
for the particular sb version in secondary_sb_wack(). If any non-zero
data is detected, the entire range is reset to zero. Subsequently,
various valid superblock fields are checked for valid/expected data.

The sb_pquotino field is checked unconditionally as part of this
sequence even though it is a v5 only field. As a result, repair
complains about a non-null project quota field if any garbage data
exists for a v4 secondary sb. This is reproduced by xfs/070 against a v4
superblock and is also easily reproduced manually as follows:

$ mkfs.xfs -f -m crc=0 <dev>
$ xfs_db -x -c "sb 3" -c "write lsn 1" <dev>
$ xfs_repair <dev>
...
zeroing unused portion of secondary superblock (AG #3)
non-null project quota inode field in superblock 3
...

This occurs because the garbage data detection mechanism has reset
sb->sb_pquotino to 0 while the validity check expects a value of
NULLFSINO.

Update secondary_sb_wack() to only check sb->sb_pquotino for validity on
supers where it is a valid field. If it is anything other than 0 on
pre-v5 superblocks, it is explicitly reset to 0 by the garbage data
checks earlier in the function.

Reported-by: Xing Gu <gux.fnst@cn.fujitsu.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/agheader.c