]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: access superblock via pagecache in scan_one_device
authorDavid Sterba <dsterba@suse.cz>
Fri, 15 Feb 2013 18:31:02 +0000 (11:31 -0700)
committerChris Mason <chris.mason@fusionio.com>
Fri, 15 Feb 2013 21:57:47 +0000 (16:57 -0500)
commitb2180d4221f0b6d089f69d5d8bf247df48373b65
tree8cdca02d09d86f1e26b9a030ac39aa3675e2cd01
parent1dea209e3f49a7ebb116962de5f662cbf01d45be
btrfs: access superblock via pagecache in scan_one_device

btrfs_scan_one_device is calling set_blocksize() which can race
with a concurrent process making dirty page cache pages.  It can end up
dropping dirty page cache pages on the floor, which isn't very nice when
someone is just running btrfs dev scan to find filesystems on the
box.

Now that udev is registering btrfs devices as it discovers them, we can
actually end up racing with our own mkfs program too.  When this
happens, we drop some of the important blocks written by mkfs.

This commit changes scan_one_device to read the super out of the page
cache instead of trying to use bread.  This way we don't have to care
about the blocksize of the device.

This also drops the invalidate_bdev() call.  It wasn't very polite to
invalidate during the scan either.  mkfs is putting the super into the
page cache, there's no reason to invalidate at this point.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/volumes.c