• Brian Foster's avatar
    xfs: don't drain buffer lru on freeze and read-only remount · 8321ddb2
    Brian Foster authored
    xfs_buftarg_drain() is called from xfs_log_quiesce() to ensure the
    buffer cache is reclaimed during unmount. xfs_log_quiesce() is also
    called from xfs_quiesce_attr(), however, which means that cache
    state is completely drained for filesystem freeze and read-only
    remount. While technically harmless, this is unnecessarily
    heavyweight. Both freeze and read-only mounts allow reads and thus
    allow population of the buffer cache. Therefore, the transitional
    sequence in either case really only needs to quiesce outstanding
    writes to return the filesystem in a generally read-only state.
    
    Additionally, some users have reported that attempts to freeze a
    filesystem concurrent with a read-heavy workload causes the freeze
    process to stall for a significant amount of time. This occurs
    because, as mentioned above, the read workload repopulates the
    buffer LRU while the freeze task attempts to drain it.
    
    To improve this situation, replace the drain in xfs_log_quiesce()
    with a buffer I/O quiesce and lift the drain into the unmount path.
    This removes buffer LRU reclaim from freeze and read-only [re]mount,
    but ensures the LRU is still drained before the filesystem unmounts.
    Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    8321ddb2
xfs_buf.c 58.1 KB