The attached patch zeros all the secondary superblocks if
overwriting an existing XFS filesystem.
This allows xfs_repair to detect the correct secondary block
if the primary is destroyed (like XFS QA test 030).
To demonstrate the bad behaviour, try the following:
# mkfs.xfs -f /dev/xxx
... [note agcount reported]
# dd if=/dev/zero of=/dev/xxx oflag=direct bs=512 count=1
# xfs_repair /dev/xxx
...
(it should recover and a second repair will succeed.)
# mkfs.xfs -f -d agcount=<smaller than above> /dev/xxx
...
# dd if=/dev/zero of=/dev/xxx oflag=direct bs=512 count=1
# xfs_repair /dev/xxx
It will either die or succeed (in my test, xfs_repair
actually crashed because it doesn't handle bad extents yet!).
If success, try and mount it and run:
# xfs_info /dev/xxx
(It should be the geometry of the first mkfs run.)
Try the patch and repeat - success.
mkfs_zero_old_ags.patch
Description: Binary data
|