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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Sep 2020 11:55:30 +0000 (13:55 +0200)
commitb730cc810f71f7b2126d390b63b981e744777c35
tree7febc1c91de178f9fb304bef3dca9bc11525607c
parent7ded6f75c325101cc230c72c650ec7bb734d490c
block: restore a specific error code in bdev_del_partition

[ Upstream commit 88ce2a530cc9865a894454b2e40eba5957a60e1a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
block/partitions/core.c