]> asedeno.scripts.mit.edu Git - linux.git/commit
xfs: rework secondary superblock updates in growfs
authorDave Chinner <dchinner@redhat.com>
Mon, 14 May 2018 06:10:08 +0000 (23:10 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 16 May 2018 01:12:51 +0000 (18:12 -0700)
commit8125147288db7008c872a946210028bbf6c0af86
tree8c72e7405fb6bd6b22037d2e9d3409d33b820c0f
parent83a7f86e39ff5d60ba2ea2e24879e136d8e9a114
xfs: rework secondary superblock updates in growfs

Right now we wait until we've committed changes to the primary
superblock before we initialise any of the new secondary
superblocks. This means that if we have any write errors for new
secondary superblocks we end up with garbage in place rather than
zeros or even an "in progress" superblock to indicate a grow
operation is being done.

To ensure we can write the secondary superblocks, initialise them
earlier in the same loop that initialises the AG headers. We stamp
the new secondary superblocks here with the old geometry, but set
the "sb_inprogress" field to indicate that updates are being done to
the superblock so they cannot be used.  This will result in the
secondary superblock fields being updated or triggering errors that
will abort the grow before we commit any permanent changes.

This also means we can change the update mechanism of the secondary
superblocks.  We know that we are going to wholly overwrite the
information in the struct xfs_sb in the buffer, so there's no point
reading it from disk. Just allocate an uncached buffer, zero it in
memory, stamp the new superblock structure in it and write it out.
If we fail to write it out, then we'll leave the existing sb (old or
new w/ inprogress) on disk for repair to deal with later.

Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_fsops.c