]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge commit '50abcc179e0c9ca667feb223b26ea406d5c4c556' of git://git.infradead.org...
authorJens Axboe <axboe@kernel.dk>
Thu, 2 May 2024 13:22:51 +0000 (07:22 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 2 May 2024 13:22:51 +0000 (07:22 -0600)
Pull NVMe fixes from Keith.

* git://git.infradead.org/nvme:
  nvme-tcp: strict pdu pacing to avoid send stalls on TLS
  nvmet: fix nvme status code when namespace is disabled
  nvmet-tcp: fix possible memory leak when tearing down a controller
  nvme: cancel pending I/O if nvme controller is in terminal state
  nvmet-auth: replace pr_debug() with pr_err() to report an error.
  nvmet-auth: return the error code to the nvmet_auth_host_hash() callers
  nvme: find numa distance only if controller has valid numa id
  nvme: fix warn output about shared namespaces without CONFIG_NVME_MULTIPATH

block/bdev.c
block/blk-core.c
block/blk-iocost.c
block/ioctl.c
drivers/block/ublk_drv.c
include/linux/blkdev.h

index 7a5f611c3d2e3e83eb00be12b9131f49d8348f5e..cea51dca875315402ac4d2b6ad207402355e7906 100644 (file)
@@ -652,6 +652,14 @@ static void blkdev_flush_mapping(struct block_device *bdev)
        bdev_write_inode(bdev);
 }
 
+static void blkdev_put_whole(struct block_device *bdev)
+{
+       if (atomic_dec_and_test(&bdev->bd_openers))
+               blkdev_flush_mapping(bdev);
+       if (bdev->bd_disk->fops->release)
+               bdev->bd_disk->fops->release(bdev->bd_disk);
+}
+
 static int blkdev_get_whole(struct block_device *bdev, blk_mode_t mode)
 {
        struct gendisk *disk = bdev->bd_disk;
@@ -670,20 +678,21 @@ static int blkdev_get_whole(struct block_device *bdev, blk_mode_t mode)
 
        if (!atomic_read(&bdev->bd_openers))
                set_init_blocksize(bdev);
-       if (test_bit(GD_NEED_PART_SCAN, &disk->state))
-               bdev_disk_changed(disk, false);
        atomic_inc(&bdev->bd_openers);
+       if (test_bit(GD_NEED_PART_SCAN, &disk->state)) {
+               /*
+                * Only return scanning errors if we are called from contexts
+                * that explicitly want them, e.g. the BLKRRPART ioctl.
+                */
+               ret = bdev_disk_changed(disk, false);
+               if (ret && (mode & BLK_OPEN_STRICT_SCAN)) {
+                       blkdev_put_whole(bdev);
+                       return ret;
+               }
+       }
        return 0;
 }
 
-static void blkdev_put_whole(struct block_device *bdev)
-{
-       if (atomic_dec_and_test(&bdev->bd_openers))
-               blkdev_flush_mapping(bdev);
-       if (bdev->bd_disk->fops->release)
-               bdev->bd_disk->fops->release(bdev->bd_disk);
-}
-
 static int blkdev_get_part(struct block_device *part, blk_mode_t mode)
 {
        struct gendisk *disk = part->bd_disk;
index 3a6f5603fb44b6c8b524ee2da68f033a0b894835..b795ac177281ad7adec63528d53def2fff1139a5 100644 (file)
@@ -1197,6 +1197,7 @@ void __blk_flush_plug(struct blk_plug *plug, bool from_schedule)
        if (unlikely(!rq_list_empty(plug->cached_rq)))
                blk_mq_free_plug_rqs(plug);
 
+       plug->cur_ktime = 0;
        current->flags &= ~PF_BLOCK_TS;
 }
 
index baa20c85799d54a86df05aa412c2e38849a800b4..690ca99dfaca6772a2b17142aacd52d4c49fe673 100644 (file)
@@ -1439,8 +1439,11 @@ static void iocg_pay_debt(struct ioc_gq *iocg, u64 abs_vpay,
        lockdep_assert_held(&iocg->ioc->lock);
        lockdep_assert_held(&iocg->waitq.lock);
 
-       /* make sure that nobody messed with @iocg */
-       WARN_ON_ONCE(list_empty(&iocg->active_list));
+       /*
+        * make sure that nobody messed with @iocg. Check iocg->pd.online
+        * to avoid warn when removing blkcg or disk.
+        */
+       WARN_ON_ONCE(list_empty(&iocg->active_list) && iocg->pd.online);
        WARN_ON_ONCE(iocg->inuse > 1);
 
        iocg->abs_vdebt -= min(abs_vpay, iocg->abs_vdebt);
index a9028a2c2db57b0881b7faf7cee2243148d1626c..f505f9c341eb08bd57bbcb729f603b5ac48453f0 100644 (file)
@@ -563,7 +563,8 @@ static int blkdev_common_ioctl(struct block_device *bdev, blk_mode_t mode,
                        return -EACCES;
                if (bdev_is_partition(bdev))
                        return -EINVAL;
-               return disk_scan_partitions(bdev->bd_disk, mode);
+               return disk_scan_partitions(bdev->bd_disk,
+                               mode | BLK_OPEN_STRICT_SCAN);
        case BLKTRACESTART:
        case BLKTRACESTOP:
        case BLKTRACETEARDOWN:
index bea3d5cf8a83487909270d5f2398267250507a31..374e4efa8759fba62df2cdbbc49c9428ddb5ea5b 100644 (file)
@@ -2177,7 +2177,8 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd)
                .max_hw_sectors         = p->max_sectors,
                .chunk_sectors          = p->chunk_sectors,
                .virt_boundary_mask     = p->virt_boundary_mask,
-
+               .max_segments           = USHRT_MAX,
+               .max_segment_size       = UINT_MAX,
        };
        struct gendisk *disk;
        int ret = -EINVAL;
index c3e8f7cf96be9e1c10169d2e7afe31696082eb8f..d16320852c4ba237a0524c0d92fbdce816d558d2 100644 (file)
@@ -128,6 +128,8 @@ typedef unsigned int __bitwise blk_mode_t;
 #define BLK_OPEN_WRITE_IOCTL   ((__force blk_mode_t)(1 << 4))
 /* open is exclusive wrt all other BLK_OPEN_WRITE opens to the device */
 #define BLK_OPEN_RESTRICT_WRITES       ((__force blk_mode_t)(1 << 5))
+/* return partition scanning errors */
+#define BLK_OPEN_STRICT_SCAN   ((__force blk_mode_t)(1 << 6))
 
 struct gendisk {
        /*