]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: Wait for uuid-tree rebuild task on remount read-only
authorStefan Behrens <sbehrens@giantdisaster.de>
Fri, 11 Oct 2013 15:14:58 +0000 (17:14 +0200)
committerChris Mason <chris.mason@fusionio.com>
Tue, 12 Nov 2013 03:01:18 +0000 (22:01 -0500)
commit7a8716aa1d7e60d41160af2df8b7cd33abd75de0
treed98d188e9350117d7dcc0a5d08cab65bec0fca08
parenta4c9dc76480e483545ded017cc5b7179d37248d3
Btrfs: Wait for uuid-tree rebuild task on remount read-only

If the user remounts the filesystem read-only while the uuid-tree
scan and rebuild task is still running (this happens once after the
filesystem was mounted with an old kernel, or when forced with the
mount options), the remount should wait on the tasks completion
before setting the filesystem read-only. Otherwise the background
task continues to write to the filesystem which is apparently not
what users expect.

The reproducer:

TEST_DEV=/dev/sdzzzzz1
TEST_MNT=/mnt
mkfs.btrfs -f $TEST_DEV
mount $TEST_DEV $TEST_MNT
for i in `seq 50000`; do btrfs subvolume create ${TEST_MNT}/$i; done
umount $TEST_MNT
mount $TEST_DEV $TEST_MNT -o rescan_uuid_tree
sleep 1
ps -elf | fgrep '[btrfs-uuid]' | grep -v grep
mount $TEST_DEV $TEST_MNT -o ro,remount
ps -elf | fgrep '[btrfs-uuid]' | grep -v grep
sleep 1
umount $TEST_MNT

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/super.c