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-6.9-20240420' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:
"Just two minor fixes that should go into the 6.9 kernel release, one
fixing a regression with partition scanning errors, and one fixing a
WARN_ON() that can get triggered if we race with a timer"

* tag 'block-6.9-20240420' of git://git.kernel.dk/linux:
blk-iocost: do not WARN if iocg was already offlined
block: propagate partition scanning errors to the BLKRRPART ioctl

+28 -13
+19 -10
block/bdev.c
··· 645 645 bdev_write_inode(bdev); 646 646 } 647 647 648 + static void blkdev_put_whole(struct block_device *bdev) 649 + { 650 + if (atomic_dec_and_test(&bdev->bd_openers)) 651 + blkdev_flush_mapping(bdev); 652 + if (bdev->bd_disk->fops->release) 653 + bdev->bd_disk->fops->release(bdev->bd_disk); 654 + } 655 + 648 656 static int blkdev_get_whole(struct block_device *bdev, blk_mode_t mode) 649 657 { 650 658 struct gendisk *disk = bdev->bd_disk; ··· 671 663 672 664 if (!atomic_read(&bdev->bd_openers)) 673 665 set_init_blocksize(bdev); 674 - if (test_bit(GD_NEED_PART_SCAN, &disk->state)) 675 - bdev_disk_changed(disk, false); 676 666 atomic_inc(&bdev->bd_openers); 667 + if (test_bit(GD_NEED_PART_SCAN, &disk->state)) { 668 + /* 669 + * Only return scanning errors if we are called from contexts 670 + * that explicitly want them, e.g. the BLKRRPART ioctl. 671 + */ 672 + ret = bdev_disk_changed(disk, false); 673 + if (ret && (mode & BLK_OPEN_STRICT_SCAN)) { 674 + blkdev_put_whole(bdev); 675 + return ret; 676 + } 677 + } 677 678 return 0; 678 - } 679 - 680 - static void blkdev_put_whole(struct block_device *bdev) 681 - { 682 - if (atomic_dec_and_test(&bdev->bd_openers)) 683 - blkdev_flush_mapping(bdev); 684 - if (bdev->bd_disk->fops->release) 685 - bdev->bd_disk->fops->release(bdev->bd_disk); 686 679 } 687 680 688 681 static int blkdev_get_part(struct block_device *part, blk_mode_t mode)
+5 -2
block/blk-iocost.c
··· 1439 1439 lockdep_assert_held(&iocg->ioc->lock); 1440 1440 lockdep_assert_held(&iocg->waitq.lock); 1441 1441 1442 - /* make sure that nobody messed with @iocg */ 1443 - WARN_ON_ONCE(list_empty(&iocg->active_list)); 1442 + /* 1443 + * make sure that nobody messed with @iocg. Check iocg->pd.online 1444 + * to avoid warn when removing blkcg or disk. 1445 + */ 1446 + WARN_ON_ONCE(list_empty(&iocg->active_list) && iocg->pd.online); 1444 1447 WARN_ON_ONCE(iocg->inuse > 1); 1445 1448 1446 1449 iocg->abs_vdebt -= min(abs_vpay, iocg->abs_vdebt);
+2 -1
block/ioctl.c
··· 563 563 return -EACCES; 564 564 if (bdev_is_partition(bdev)) 565 565 return -EINVAL; 566 - return disk_scan_partitions(bdev->bd_disk, mode); 566 + return disk_scan_partitions(bdev->bd_disk, 567 + mode | BLK_OPEN_STRICT_SCAN); 567 568 case BLKTRACESTART: 568 569 case BLKTRACESTOP: 569 570 case BLKTRACETEARDOWN:
+2
include/linux/blkdev.h
··· 128 128 #define BLK_OPEN_WRITE_IOCTL ((__force blk_mode_t)(1 << 4)) 129 129 /* open is exclusive wrt all other BLK_OPEN_WRITE opens to the device */ 130 130 #define BLK_OPEN_RESTRICT_WRITES ((__force blk_mode_t)(1 << 5)) 131 + /* return partition scanning errors */ 132 + #define BLK_OPEN_STRICT_SCAN ((__force blk_mode_t)(1 << 6)) 131 133 132 134 struct gendisk { 133 135 /*