]> git.baikalelectronics.ru Git - kernel.git/commitdiff
block: restore a specific error code in bdev_del_partition
authorChristoph Hellwig <hch@lst.de>
Tue, 8 Sep 2020 14:15:06 +0000 (16:15 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 8 Sep 2020 14:18:24 +0000 (08:18 -0600)
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: 3e441c562663 ("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>
block/partitions/core.c

index 5b4869c08fb3800ce9ed0a4619b0e3721763e05e..722406b841dfc7b44a76be504afc2495e175ef3d 100644 (file)
@@ -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);