aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2018-07-03 17:07:23 +0800
committerDavid Sterba <dsterba@suse.com>2018-08-06 13:12:45 +0200
commitb4993e64f78a9605b45252fa9ba385c88a1f4ce9 (patch)
tree8d83936371abc9a086c1b434d920467c9fb46248 /fs/btrfs
parentbtrfs: qgroups: Move transaction management inside btrfs_quota_enable/disable (diff)
downloadlinux-dev-b4993e64f78a9605b45252fa9ba385c88a1f4ce9.tar.xz
linux-dev-b4993e64f78a9605b45252fa9ba385c88a1f4ce9.zip
btrfs: fix in-memory value of total_devices after seed device deletion
In case of deleting the seed device the %cur_devices (seed) and the %fs_devices (parent) are different. Now, as the parent fs_devices::total_devices also maintains the total number of devices including the seed device, so decrement its in-memory value for the successful seed delete. We are already updating its corresponding on-disk btrfs_super_block::number_devices value. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/volumes.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 211fb2161487..f532e855b507 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2026,6 +2026,9 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
cur_devices->num_devices--;
cur_devices->total_devices--;
+ /* Update total_devices of the parent fs_devices if it's seed */
+ if (cur_devices != fs_devices)
+ fs_devices->total_devices--;
if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state))
cur_devices->missing_devices--;