Skip to content

Commit

Permalink
block: restore a specific error code in bdev_del_partition
Browse files Browse the repository at this point in the history
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: 08fc1ab ("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>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Sep 8, 2020
1 parent 7e24969 commit 88ce2a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/partitions/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 88ce2a5

Please sign in to comment.