On Fri, Mar 08, 2024 at 09:32:54AM -0800, Boris Burkov wrote: > You remove/add the device in a way that results in a new bd_dev while > the filesystem is unmounted but btrfs is still caching the struct > btrfs_device. When we unmount a multi-device fs, we don't clear the > device cache, since we need it to remount with just one device name > later. > > The mechanism I used for getting a different bd_dev was partitioning two > different devices in two different orders. Ok, so we have a btrfs_device without a bdev around, which seems a bit dangerous. Also relying on the dev_t for any kind of device identify seems very dangerous. Aren't there per-device UUIDs or similar identifiers that are actually reliabe and can be used instead of the dev_t?