• Dave Chinner's avatar
    xfs: rework secondary superblock updates in growfs · 81251472
    Dave Chinner authored
    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: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    81251472
xfs_fsops.c 29.1 KB