Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'block-5.5-2020-01-26' of git://git.kernel.dk/linux-block

Pull block fix from Jens Axboe:
"Unfortunately this weekend we had a few last minute reports, one was
for block.

The partition disable for zoned devices was overly restrictive, it can
work (and be supported) just fine for host-aware variants.

Here's a fix ensuring that's the case so we don't break existing users
of that"

* tag 'block-5.5-2020-01-26' of git://git.kernel.dk/linux-block:
block: allow partitions on host aware zone devices

+39 -8
+22 -4
block/partition-generic.c
··· 321 321 const char *dname; 322 322 int err; 323 323 324 + /* 325 + * Partitions are not supported on zoned block devices that are used as 326 + * such. 327 + */ 328 + switch (disk->queue->limits.zoned) { 329 + case BLK_ZONED_HM: 330 + pr_warn("%s: partitions not supported on host managed zoned block device\n", 331 + disk->disk_name); 332 + return ERR_PTR(-ENXIO); 333 + case BLK_ZONED_HA: 334 + pr_info("%s: disabling host aware zoned block device support due to partitions\n", 335 + disk->disk_name); 336 + disk->queue->limits.zoned = BLK_ZONED_NONE; 337 + break; 338 + case BLK_ZONED_NONE: 339 + break; 340 + } 341 + 324 342 err = disk_expand_part_tbl(disk, partno); 325 343 if (err) 326 344 return ERR_PTR(err); ··· 519 501 520 502 part = add_partition(disk, p, from, size, state->parts[p].flags, 521 503 &state->parts[p].info); 522 - if (IS_ERR(part)) { 504 + if (IS_ERR(part) && PTR_ERR(part) != -ENXIO) { 523 505 printk(KERN_ERR " %s: p%d could not be added: %ld\n", 524 506 disk->disk_name, p, -PTR_ERR(part)); 525 507 return true; ··· 558 540 } 559 541 560 542 /* 561 - * Partitions are not supported on zoned block devices. 543 + * Partitions are not supported on host managed zoned block devices. 562 544 */ 563 - if (bdev_is_zoned(bdev)) { 564 - pr_warn("%s: ignoring partition table on zoned block device\n", 545 + if (disk->queue->limits.zoned == BLK_ZONED_HM) { 546 + pr_warn("%s: ignoring partition table on host managed zoned block device\n", 565 547 disk->disk_name); 566 548 ret = 0; 567 549 goto out_free_state;
+5 -4
drivers/scsi/sd.c
··· 2958 2958 q->limits.zoned = BLK_ZONED_HM; 2959 2959 } else { 2960 2960 sdkp->zoned = (buffer[8] >> 4) & 3; 2961 - if (sdkp->zoned == 1) 2961 + if (sdkp->zoned == 1 && !disk_has_partitions(sdkp->disk)) { 2962 2962 /* Host-aware */ 2963 2963 q->limits.zoned = BLK_ZONED_HA; 2964 - else 2964 + } else { 2965 2965 /* 2966 - * Treat drive-managed devices as 2967 - * regular block devices. 2966 + * Treat drive-managed devices and host-aware devices 2967 + * with partitions as regular block devices. 2968 2968 */ 2969 2969 q->limits.zoned = BLK_ZONED_NONE; 2970 + } 2970 2971 } 2971 2972 if (blk_queue_is_zoned(q) && sdkp->first_scan) 2972 2973 sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n",
+12
include/linux/genhd.h
··· 245 245 !(disk->flags & GENHD_FL_NO_PART_SCAN); 246 246 } 247 247 248 + static inline bool disk_has_partitions(struct gendisk *disk) 249 + { 250 + bool ret = false; 251 + 252 + rcu_read_lock(); 253 + if (rcu_dereference(disk->part_tbl)->len > 1) 254 + ret = true; 255 + rcu_read_unlock(); 256 + 257 + return ret; 258 + } 259 + 248 260 static inline dev_t disk_devt(struct gendisk *disk) 249 261 { 250 262 return MKDEV(disk->major, disk->first_minor);