Skip to contentSkip to conversation

btrfs: get the device in write mode when deleting it

PATCH New Lukas Czerner 1 participant 1 message Dec 7, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: get the device in write mode when deleting it

When we're deleting the device we should get it in write mode since we're going to re-write the super block magic on that device. And it should fail if the device is read-only.

---
 fs/btrfs/volumes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/volumes.c +1 -1
index 95c6f7d..e3b9b36 100644
@@ -1384,7 +1384,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
 			goto out;
 		}
 	} else {
-		bdev = blkdev_get_by_path(device_path, FMODE_READ | FMODE_EXCL,
+		bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL,
 					  root->fs_info->bdev_holder);
 		if (IS_ERR(bdev)) {
 			ret = PTR_ERR(bdev);
Signature · 1 line
1.7.7.6