• Darrick J. Wong's avatar
    xfs: fix scrub and remount-ro protection when running scrub · 71bddbcc
    Darrick J. Wong authored
    While running a new fstest that races a readonly remount with scrub
    running in repair mode, I observed the kernel tripping over debugging
    assertions in the log quiesce code that were checking that the CIL was
    empty.  When the sysadmin runs scrub in repair mode, the scrub code
    allocates real transactions (with reservations) to change things, but
    doesn't increment the superblock writers count to block a readonly
    remount attempt while it is running.
    
    We don't require the userspace caller to have a writable file descriptor
    to run repairs, so we have to call mnt_want_write_file to obtain freeze
    protection and increment the writers count.  It's ok to remove the call
    to sb_start_write for the dry-run case because commit 8321ddb2
    removed the behavior where scrub and fsfreeze fight over the buffer LRU.
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChandan Babu R <chandanrlinux@gmail.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    71bddbcc
xfs_scrub.h 425 Bytes