]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix scrub and remount-ro protection when running scrub
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Mar 2021 16:51:51 +0000 (09:51 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 9 Apr 2021 17:27:13 +0000 (10:27 -0700)
commit245d61dc9428c2c8bad5257696ebcbbe1926d0cc
tree41c7465a6ff174435ec273ff5b51a2a6b5475581
parentc5419f904ef8ac0f13560f8edd6ec4cab72635d6
xfs: fix scrub and remount-ro protection when running scrub

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 7305e5fd8737
removed the behavior where scrub and fsfreeze fight over the buffer LRU.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/scrub/scrub.c
fs/xfs/scrub/scrub.h
fs/xfs/scrub/xfs_scrub.h
fs/xfs/xfs_ioctl.c