]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: use num_device to check for the last surviving seed device
authorAnand Jain <anand.jain@oracle.com>
Tue, 5 Oct 2021 20:12:39 +0000 (16:12 -0400)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Oct 2021 17:08:06 +0000 (19:08 +0200)
commit19d9f36d273627146496ba32b34e638d03019cbd
treee41d6cc6164117fc9f0424362941d63229826bca
parent6f93c4c3e9028f8597df9c0b47163b5eb01f925c
btrfs: use num_device to check for the last surviving seed device

For both sprout and seed fsids,
 btrfs_fs_devices::num_devices provides device count including missing
 btrfs_fs_devices::open_devices provides device count excluding missing

We create a dummy struct btrfs_device for the missing device, so
num_devices != open_devices when there is a missing device.

In btrfs_rm_devices() we wrongly check for %cur_devices->open_devices
before freeing the seed fs_devices. Instead we should check for
%cur_devices->num_devices.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c