• B
    xfs: cover the log during log quiesce · 303591a0
    Brian Foster 提交于
    The log quiesce mechanism historically terminates by marking the log
    clean with an unmount record. The primary objective is to indicate
    that log recovery is no longer required after the quiesce has
    flushed all in-core changes and written back filesystem metadata.
    While this is perfectly fine, it is somewhat hacky as currently used
    in certain contexts. For example, filesystem freeze quiesces (i.e.
    cleans) the log and immediately redirties it with a dummy superblock
    transaction to ensure that log recovery runs in the event of a
    crash.
    
    While this functions correctly, cleaning the log from freeze context
    is clearly superfluous given the current redirtying behavior.
    Instead, the desired behavior can be achieved by simply covering the
    log. This effectively retires all on-disk log items from the active
    range of the log by issuing two synchronous and sequential dummy
    superblock update transactions that serve to update the on-disk log
    head and tail. The subtle difference is that the log technically
    remains dirty due to the lack of an unmount record, though recovery
    is effectively a no-op due to the content of the checkpoints being
    clean (i.e. the unmodified on-disk superblock).
    
    Log covering currently runs in the background and only triggers once
    the filesystem and log has idled. The purpose of the background
    mechanism is to prevent log recovery from replaying the most
    recently logged items long after those items may have been written
    back. In the quiesce path, the log has been deliberately idled by
    forcing the log and pushing the AIL until empty in a context where
    no further mutable filesystem operations are allowed. Therefore, we
    can cover the log as the final step in the log quiesce codepath to
    reflect that all previously active items have been successfully
    written back.
    
    This facilitates selective log covering from certain contexts (i.e.
    freeze) that only seek to quiesce, but not necessarily clean the
    log. Note that as a side effect of this change, log covering now
    occurs when cleaning the log as well. This is harmless, facilitates
    subsequent cleanups, and is mostly temporary as various operations
    switch to use explicit log covering.
    Signed-off-by: NBrian Foster <bfoster@redhat.com>
    Reviewed-by: NChristoph Hellwig <hch@lst.de>
    Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
    Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: NAllison Henderson <allison.henderson@oracle.com>
    303591a0
xfs_log.c 107.1 KB