summaryrefslogtreecommitdiffstats
path: root/block/partitions
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-09-08 16:15:06 +0200
committerJens Axboe <axboe@kernel.dk>2020-09-08 08:18:24 -0600
commit88ce2a530cc9865a894454b2e40eba5957a60e1a (patch)
treee5403a98c02f4342d19a1350750f81eeba6d36e6 /block/partitions
parent7e24969022cbd61ddc586f14824fc205661bb124 (diff)
downloadlinux-stable-88ce2a530cc9865a894454b2e40eba5957a60e1a.tar.gz
linux-stable-88ce2a530cc9865a894454b2e40eba5957a60e1a.tar.bz2
linux-stable-88ce2a530cc9865a894454b2e40eba5957a60e1a.zip
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") Reported-by: kernel test robot <rong.a.chen@intel.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/partitions')
-rw-r--r--block/partitions/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 5b4869c08fb3..722406b841df 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -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);