]> git.baikalelectronics.ru Git - kernel.git/commit
block: Fix partition support for host aware zoned block devices
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 21 Feb 2020 01:37:08 +0000 (10:37 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 12 Mar 2020 13:54:39 +0000 (07:54 -0600)
commit3348a8c99e0cc5c7cc50d3cc46baec6f47733de7
treebfe985113e15690714d8d099f454c5dc06c91a18
parentbba92423f4b9d3e6620d77fef21074e70c86b5b8
block: Fix partition support for host aware zoned block devices

Commit 833c04b04f60 ("block: allow partitions on host aware zone
devices") introduced the helper function disk_has_partitions() to check
if a given disk has valid partitions. However, since this function result
directly depends on the disk partition table length rather than the
actual existence of valid partitions in the table, it returns true even
after all partitions are removed from the disk. For host aware zoned
block devices, this results in zone management support to be kept
disabled even after removing all partitions.

Fix this by changing disk_has_partitions() to walk through the partition
table entries and return true if and only if a valid non-zero size
partition is found.

Fixes: 833c04b04f60 ("block: allow partitions on host aware zone devices")
Cc: stable@vger.kernel.org # 5.5
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c
include/linux/genhd.h