Skip to contentSkip to conversation

block: restore a specific error code in bdev_del_partition

PATCH Applied Christoph Hellwig 2 participants 2 messages Sep 8, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: restore a specific error code in bdev_del_partition

mdadm relies on the fact that deleting an invalid partition returns -ENXIO or -ENOTTY to detect if a block device is a partition or a whole device.

Fixes 08fc1ab6d748 ("block: fix locking in bdev_del_partition")
---
 block/partitions/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/partitions/core.c +1 -1
index 5b4869c08fb380..722406b841dfc7 100644
@@ -537,7 +537,7 @@ int bdev_del_partition(struct block_device *bdev, int partno)
 
 	bdevp = bdget_disk(bdev->bd_disk, partno);
 	if (!bdevp)
-		return -ENOMEM;
+		return -ENXIO;
 
 	mutex_lock(&bdevp->bd_mutex);
 	mutex_lock_nested(&bdev->bd_mutex, 1);
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw
Quoted 3 lines · Christoph Hellwig

mdadm relies on the fact that deleting an invalid partition returns -ENXIO or -ENOTTY to detect if a block device is a partition or a whole device.

Applied, thanks.

Signature · 1 line
Jens Axboe