dissect-image: Notify btrfs when we're done using a loop device
Let's explicitly let btrfs know when we're done using a loop device. Otherwise, btrfs will keep the device UUID cached which will result in mount() failures if we ever generate a device or filesystem with the same UUID again.
This commit is contained in:
@@ -707,6 +707,10 @@ int block_device_remove_all_partitions(sd_device *dev, int fd) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = btrfs_forget_device(devname);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_debug_errno(r, "Failed to forget btrfs device %s, ignoring: %m", devname);
|
||||
|
||||
r = block_device_remove_partition(fd, devname, nr);
|
||||
if (r == -ENODEV) {
|
||||
log_debug("Kernel removed partition %s before us, ignoring", devname);
|
||||
|
||||
Reference in New Issue
Block a user