block: Move checking GENHD_FL_NO_PART to bdev_add_partition()
authorLi Lingfeng <lilingfeng3@huawei.com>
Thu, 18 Jan 2024 13:04:01 +0000 (21:04 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 22 Jan 2024 16:51:29 +0000 (09:51 -0700)
commit7777f47f2ea64efd1016262e7b59fab34adfb869
tree7d2771ec325f962c74d8dd9bb695cecef30b85ef
parent6613476e225e090cc9aad49be7fa504e290dd33d
block: Move checking GENHD_FL_NO_PART to bdev_add_partition()

Commit 1a721de8489f ("block: don't add or resize partition on the disk
with GENHD_FL_NO_PART") prevented all operations about partitions on disks
with GENHD_FL_NO_PART in blkpg_do_ioctl() since they are meaningless.
However, it changed error code in some scenarios. So move checking
GENHD_FL_NO_PART to bdev_add_partition() to eliminate impact.

Fixes: 1a721de8489f ("block: don't add or resize partition on the disk with GENHD_FL_NO_PART")
Reported-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
Closes: https://lore.kernel.org/all/CAOYeF9VsmqKMcQjo1k6YkGNujwN-nzfxY17N3F-CMikE1tYp+w@mail.gmail.com/
Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20240118130401.792757-1-lilingfeng@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/ioctl.c
block/partitions/core.c