xfs
[Top] [All Lists]

Re: REVIEW: zero existing secondary superblocks with mkfs.xfs -f

To: "Eric Sandeen" <sandeen@xxxxxxxxxxx>
Subject: Re: REVIEW: zero existing secondary superblocks with mkfs.xfs -f
From: "Barry Naujok" <bnaujok@xxxxxxx>
Date: Thu, 12 Jul 2007 10:19:11 +1000
Cc: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>, xfs-dev <xfs-dev@xxxxxxx>
In-reply-to: <46951C0A.4080505@xxxxxxxxxxx>
Organization: SGI
References: <op.tvamambx3jf8g2@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <46951C0A.4080505@xxxxxxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Opera Mail/9.10 (Win32)
On Thu, 12 Jul 2007 04:06:02 +1000, Eric Sandeen <sandeen@xxxxxxxxxxx> wrote:

Barry Naujok wrote:
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).

Seems good to me (after filtering out all of the quilt-induced
whitespace changes ;-) )

Doh, forgot to prune that.

+       /*
+        * perform same basic superblock validation to make sure we
+        * actually zero secondary blocks
+        */
+       if (sb.sb_magicnum != XFS_SB_MAGIC || sb.sb_blocksize == 0)
+               goto done;

Is there any chance we'd be here if the first test weren't already true?
 *shrug* harmless though I guess.

It's quite easy to get there if you run mkfs.xfs -f on non-XFS
filesystem.

If something goes wrong and the old found SB is full of junk, this is
non-fatal, right.

Yep. Worst that will happen is the pwrite loop fails, and if so, it
stops and exits. Maybe one subtle enhancement is to make sure the
pwrite loop doesn't extend beyond the new filesystem size.

Out of curiosity, why not just call verify_sb for the sanity checks
instead of recreating a subset of them in zero_old_xfs_structures?

Because that code is in xfs_repair and not mkfs. With mkfs.xfs, we
don't really care if anything else in the SB is bad.

Barry.


<Prev in Thread] Current Thread [Next in Thread>