linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: restore a specific error code in bdev_del_partition
@ 2020-09-08 14:15 Christoph Hellwig
  2020-09-08 14:19 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2020-09-08 14:15 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, kernel test robot

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>
---
 block/partitions/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/partitions/core.c b/block/partitions/core.c
index 5b4869c08fb380..722406b841dfc7 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);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: restore a specific error code in bdev_del_partition
  2020-09-08 14:15 [PATCH] block: restore a specific error code in bdev_del_partition Christoph Hellwig
@ 2020-09-08 14:19 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-09-08 14:19 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block, kernel test robot

On 9/8/20 8:15 AM, Christoph Hellwig wrote:
> 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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-08 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 14:15 [PATCH] block: restore a specific error code in bdev_del_partition Christoph Hellwig
2020-09-08 14:19 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).