diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-06-10 15:17:02 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-06-10 15:17:02 -0400 |
commit | e5e9a5206a171b2c467e494aebcdcf70c47289bc (patch) | |
tree | d9a6a89cccbd084db923f1661b52d5a1dfdb83fe /fs/btrfs/volumes.h | |
parent | 7df336ec1266dccbb253bac52c529d3dcc7c22d0 (diff) |
Btrfs: avoid races between super writeout and device list updates
On multi-device filesystems, btrfs writes supers to all of the devices
before considering a sync complete. There wasn't any additional
locking between super writeout and the device list management code
because device management was done inside a transaction and
super writeout only happened with no transation writers running.
With the btrfs fsync log and other async transaction updates, this
has been racey for some time. This adds a mutex to protect
the device list. The existing volume mutex could not be reused due to
transaction lock ordering requirements.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r-- | fs/btrfs/volumes.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 3c1f7310421e..5139a833f721 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h | |||
@@ -96,7 +96,12 @@ struct btrfs_fs_devices { | |||
96 | u64 rw_devices; | 96 | u64 rw_devices; |
97 | u64 total_rw_bytes; | 97 | u64 total_rw_bytes; |
98 | struct block_device *latest_bdev; | 98 | struct block_device *latest_bdev; |
99 | /* all of the devices in the FS */ | 99 | |
100 | /* all of the devices in the FS, protected by a mutex | ||
101 | * so we can safely walk it to write out the supers without | ||
102 | * worrying about add/remove by the multi-device code | ||
103 | */ | ||
104 | struct mutex device_list_mutex; | ||
100 | struct list_head devices; | 105 | struct list_head devices; |
101 | 106 | ||
102 | /* devices not currently being allocated */ | 107 | /* devices not currently being allocated */ |