Commit 6fe0be6d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull block fixes from Jens Axboe:

 - MD pull request via Yu:
      - Fix a raid5 UAF on IO across the reshape position
      - Avoid failing RAID1/RAID10 devices for invalid IO errors
      - Fix RAID10 divide-by-zero when far_copies is zero
      - Restore bitmap grow through sysfs
      - Use mddev_is_dm() instead of open-coding gendisk checks
      - Use ATTRIBUTE_GROUPS() for md default sysfs attributes
      - Replace open-coded wait loops with wait_event helpers

 - NVMe pull request via Keith:
      - Target data transfer size configuation (Aurelien)
      - Enable P2P for RDMA (Shivaji Kant)
      - TCP target updates (Maurizio, Alistair, Chaitanya, Shivam Kumar)
      - TCP host updates (Alistair, Chaitanya)
      - Authentication updates (Alistair, Daniel, Chris Leech)
      - Multipath fixes (John Garry)
      - New quirks (Alan Cui, Tao Jiang)
      - Apple driver fix (Fedor Pchelkin)
      - PCI admin doorbell update fix (Keith)

 - Properly propagate CDROM read-only state to the block layer

* tag 'block-7.1-20260430' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (35 commits)
  md: use ATTRIBUTE_GROUPS() for md default sysfs attributes
  md: use mddev_is_dm() instead of open-coding gendisk checks
  md/raid1: replace wait loop with wait_event_idle() in raid1_write_request()
  md/md-bitmap: add a none backend for bitmap grow
  md/md-bitmap: split bitmap sysfs groups
  md: factor bitmap creation away from sysfs handling
  md: use mddev_lock_nointr() in mddev_suspend_and_lock_nointr()
  md: replace wait loop with wait_event() in md_handle_request()
  md/raid10: fix divide-by-zero in setup_geo() with zero far_copies
  md/raid1,raid10: don't fail devices for invalid IO errors
  MAINTAINERS: Add Xiao Ni as md/raid reviewer
  md/raid5: Fix UAF on IO across the reshape position
  cdrom, scsi: sr: propagate read-only status to block layer via set_disk_ro()
  nvme-auth: Hash DH shared secret to create session key
  nvme-pci: fix missed admin queue sq doorbell write
  nvme-auth: Include SC_C in RVAL controller hash
  nvme-tcp: teardown circular locking fixes
  nvmet-tcp: Don't clear tls_key when freeing sq
  Revert "nvmet-tcp: Don't free SQ on authentication success"
  nvme: skip trace completion for host path errors
  ...
parents 9d88bb92 7e36e03d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24798,6 +24798,7 @@ SOFTWARE RAID (Multiple Disks) SUPPORT
M:	Song Liu <song@kernel.org>
M:	Yu Kuai <yukuai@fnnas.com>
R:	Li Nan <linan122@huawei.com>
R:	Xiao Ni <xiao@kernel.org>
L:	linux-raid@vger.kernel.org
S:	Supported
Q:	https://patchwork.kernel.org/project/linux-raid/list/
+48 −25
Original line number Diff line number Diff line
@@ -631,6 +631,16 @@ int register_cdrom(struct gendisk *disk, struct cdrom_device_info *cdi)

	WARN_ON(!cdo->generic_packet);

	/*
	 * Propagate the drive's write support to the block layer so BLKROGET
	 * reflects actual write capability. Drivers that use GET CONFIGURATION
	 * features (CDC_MRW_W, CDC_RAM) must have called
	 * cdrom_probe_write_features() before register_cdrom() so the mask is
	 * complete here.
	 */
	set_disk_ro(disk, !CDROM_CAN(CDC_DVD_RAM | CDC_MRW_W | CDC_RAM |
				     CDC_CD_RW));

	cd_dbg(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
	mutex_lock(&cdrom_mutex);
	list_add(&cdi->list, &cdrom_list);
@@ -742,6 +752,44 @@ static int cdrom_is_random_writable(struct cdrom_device_info *cdi, int *write)
	return 0;
}

/*
 * Probe write-related MMC features via GET CONFIGURATION and update
 * cdi->mask accordingly. Drivers that populate cdi->mask from the MODE SENSE
 * capabilities page (e.g. sr) should call this after those MODE SENSE bits
 * have been set but before register_cdrom(), so that the full set of
 * write-capability bits is known by the time register_cdrom() decides on the
 * initial read-only state of the disk.
 */
void cdrom_probe_write_features(struct cdrom_device_info *cdi)
{
	int mrw, mrw_write, ram_write;

	mrw = 0;
	if (!cdrom_is_mrw(cdi, &mrw_write))
		mrw = 1;

	if (CDROM_CAN(CDC_MO_DRIVE))
		ram_write = 1;
	else
		(void) cdrom_is_random_writable(cdi, &ram_write);

	if (mrw)
		cdi->mask &= ~CDC_MRW;
	else
		cdi->mask |= CDC_MRW;

	if (mrw_write)
		cdi->mask &= ~CDC_MRW_W;
	else
		cdi->mask |= CDC_MRW_W;

	if (ram_write)
		cdi->mask &= ~CDC_RAM;
	else
		cdi->mask |= CDC_RAM;
}
EXPORT_SYMBOL(cdrom_probe_write_features);

static int cdrom_media_erasable(struct cdrom_device_info *cdi)
{
	disc_information di;
@@ -894,33 +942,8 @@ static int cdrom_is_dvd_rw(struct cdrom_device_info *cdi)
 */
static int cdrom_open_write(struct cdrom_device_info *cdi)
{
	int mrw, mrw_write, ram_write;
	int ret = 1;

	mrw = 0;
	if (!cdrom_is_mrw(cdi, &mrw_write))
		mrw = 1;

	if (CDROM_CAN(CDC_MO_DRIVE))
		ram_write = 1;
	else
		(void) cdrom_is_random_writable(cdi, &ram_write);
	
	if (mrw)
		cdi->mask &= ~CDC_MRW;
	else
		cdi->mask |= CDC_MRW;

	if (mrw_write)
		cdi->mask &= ~CDC_MRW_W;
	else
		cdi->mask |= CDC_MRW_W;

	if (ram_write)
		cdi->mask &= ~CDC_RAM;
	else
		cdi->mask |= CDC_RAM;

	if (CDROM_CAN(CDC_MRW_W))
		ret = cdrom_mrw_open_write(cdi);
	else if (CDROM_CAN(CDC_DVD_RAM))
+119 −12
Original line number Diff line number Diff line
@@ -216,6 +216,7 @@ struct bitmap {
};

static struct workqueue_struct *md_bitmap_wq;
static struct attribute_group md_bitmap_internal_group;

static int __bitmap_resize(struct bitmap *bitmap, sector_t blocks,
			   int chunksize, bool init);
@@ -2580,6 +2581,30 @@ static int bitmap_resize(struct mddev *mddev, sector_t blocks, int chunksize)
	return __bitmap_resize(bitmap, blocks, chunksize, false);
}

static bool bitmap_none_enabled(void *data, bool flush)
{
	return false;
}

static int bitmap_none_create(struct mddev *mddev)
{
	return 0;
}

static int bitmap_none_load(struct mddev *mddev)
{
	return 0;
}

static void bitmap_none_destroy(struct mddev *mddev)
{
}

static int bitmap_none_get_stats(void *data, struct md_bitmap_stats *stats)
{
	return -ENOENT;
}

static ssize_t
location_show(struct mddev *mddev, char *page)
{
@@ -2618,7 +2643,11 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
			goto out;
		}

		bitmap_destroy(mddev);
		sysfs_unmerge_group(&mddev->kobj, &md_bitmap_internal_group);
		md_bitmap_destroy_nosysfs(mddev);
		mddev->bitmap_id = ID_BITMAP_NONE;
		if (!mddev_set_bitmap_ops_nosysfs(mddev))
			goto none_err;
		mddev->bitmap_info.offset = 0;
		if (mddev->bitmap_info.file) {
			struct file *f = mddev->bitmap_info.file;
@@ -2654,16 +2683,25 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
			}

			mddev->bitmap_info.offset = offset;
			rv = bitmap_create(mddev);
			md_bitmap_destroy_nosysfs(mddev);
			mddev->bitmap_id = ID_BITMAP;
			if (!mddev_set_bitmap_ops_nosysfs(mddev))
				goto bitmap_err;

			rv = md_bitmap_create_nosysfs(mddev);
			if (rv)
				goto out;
				goto create_err;

			rv = bitmap_load(mddev);
			rv = mddev->bitmap_ops->load(mddev);
			if (rv) {
				mddev->bitmap_info.offset = 0;
				bitmap_destroy(mddev);
				goto out;
				goto load_err;
			}

			rv = sysfs_merge_group(&mddev->kobj,
					       &md_bitmap_internal_group);
			if (rv)
				goto merge_err;
		}
	}
	if (!mddev->external) {
@@ -2679,6 +2717,22 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
	if (rv)
		return rv;
	return len;

merge_err:
	mddev->bitmap_info.offset = 0;
load_err:
	md_bitmap_destroy_nosysfs(mddev);
create_err:
	mddev->bitmap_info.offset = 0;
	mddev->bitmap_id = ID_BITMAP_NONE;
	if (!mddev_set_bitmap_ops_nosysfs(mddev))
		rv = -ENOENT;
	goto out;
bitmap_err:
	rv = -ENOENT;
none_err:
	mddev->bitmap_info.offset = 0;
	goto out;
}

static struct md_sysfs_entry bitmap_location =
@@ -2955,8 +3009,12 @@ static struct md_sysfs_entry max_backlog_used =
__ATTR(max_backlog_used, S_IRUGO | S_IWUSR,
       behind_writes_used_show, behind_writes_used_reset);

static struct attribute *md_bitmap_attrs[] = {
static struct attribute *md_bitmap_common_attrs[] = {
	&bitmap_location.attr,
	NULL
};

static struct attribute *md_bitmap_internal_attrs[] = {
	&bitmap_space.attr,
	&bitmap_timeout.attr,
	&bitmap_backlog.attr,
@@ -2967,9 +3025,41 @@ static struct attribute *md_bitmap_attrs[] = {
	NULL
};

static struct attribute_group md_bitmap_group = {
static struct attribute_group md_bitmap_common_group = {
	.name = "bitmap",
	.attrs = md_bitmap_common_attrs,
};

static struct attribute_group md_bitmap_internal_group = {
	.name = "bitmap",
	.attrs = md_bitmap_attrs,
	.attrs = md_bitmap_internal_attrs,
};

static const struct attribute_group *bitmap_groups[] = {
	&md_bitmap_common_group,
	&md_bitmap_internal_group,
	NULL,
};

static const struct attribute_group *bitmap_none_groups[] = {
	&md_bitmap_common_group,
	NULL,
};

static struct bitmap_operations bitmap_none_ops = {
	.head = {
		.type	= MD_BITMAP,
		.id	= ID_BITMAP_NONE,
		.name	= "none",
	},

	.enabled		= bitmap_none_enabled,
	.create			= bitmap_none_create,
	.load			= bitmap_none_load,
	.destroy		= bitmap_none_destroy,
	.get_stats		= bitmap_none_get_stats,

	.groups			= bitmap_none_groups,
};

static struct bitmap_operations bitmap_ops = {
@@ -3013,21 +3103,38 @@ static struct bitmap_operations bitmap_ops = {
	.set_pages		= bitmap_set_pages,
	.free			= md_bitmap_free,

	.group			= &md_bitmap_group,
	.groups			= bitmap_groups,
};

int md_bitmap_init(void)
{
	int err;

	md_bitmap_wq = alloc_workqueue("md_bitmap", WQ_MEM_RECLAIM | WQ_UNBOUND,
				       0);
	if (!md_bitmap_wq)
		return -ENOMEM;

	return register_md_submodule(&bitmap_ops.head);
	err = register_md_submodule(&bitmap_none_ops.head);
	if (err)
		goto err_wq;

	err = register_md_submodule(&bitmap_ops.head);
	if (err)
		goto err_none;

	return 0;

err_none:
	unregister_md_submodule(&bitmap_none_ops.head);
err_wq:
	destroy_workqueue(md_bitmap_wq);
	return err;
}

void md_bitmap_exit(void)
{
	destroy_workqueue(md_bitmap_wq);
	unregister_md_submodule(&bitmap_ops.head);
	unregister_md_submodule(&bitmap_none_ops.head);
	destroy_workqueue(md_bitmap_wq);
}
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ struct bitmap_operations {
	void (*set_pages)(void *data, unsigned long pages);
	void (*free)(void *data);

	struct attribute_group *group;
	const struct attribute_group **groups;
};

/* the bitmap API */
+6 −1
Original line number Diff line number Diff line
@@ -1738,6 +1738,11 @@ static struct attribute_group md_llbitmap_group = {
	.attrs = md_llbitmap_attrs,
};

static const struct attribute_group *md_llbitmap_groups[] = {
	&md_llbitmap_group,
	NULL,
};

static struct bitmap_operations llbitmap_ops = {
	.head = {
		.type	= MD_BITMAP,
@@ -1774,7 +1779,7 @@ static struct bitmap_operations llbitmap_ops = {
	.dirty_bits		= llbitmap_dirty_bits,
	.write_all		= llbitmap_write_all,

	.group			= &md_llbitmap_group,
	.groups			= md_llbitmap_groups,
};

int md_llbitmap_init(void)
Loading