On Fri, Mar 08, 2024 at 09:42:56AM -0800, Christoph Hellwig wrote: > 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? > I was led to believe this wasn't possible while still actually implementing temp_fsid. But now that I think of it again, I am less sure. You could imagine them having identical images except a device uuid and the code being smart enough to handle that. Maybe Anand can explain why that wouldn't work :)