Skip to content

Commit 6fe0be6

Browse files
committed
Merge tag 'block-7.1-20260430' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
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 ...
2 parents 9d88bb9 + 7e36e03 commit 6fe0be6

33 files changed

Lines changed: 587 additions & 275 deletions

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24798,6 +24798,7 @@ SOFTWARE RAID (Multiple Disks) SUPPORT
2479824798
M: Song Liu <song@kernel.org>
2479924799
M: Yu Kuai <yukuai@fnnas.com>
2480024800
R: Li Nan <linan122@huawei.com>
24801+
R: Xiao Ni <xiao@kernel.org>
2480124802
L: linux-raid@vger.kernel.org
2480224803
S: Supported
2480324804
Q: https://patchwork.kernel.org/project/linux-raid/list/

drivers/cdrom/cdrom.c

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,16 @@ int register_cdrom(struct gendisk *disk, struct cdrom_device_info *cdi)
631631

632632
WARN_ON(!cdo->generic_packet);
633633

634+
/*
635+
* Propagate the drive's write support to the block layer so BLKROGET
636+
* reflects actual write capability. Drivers that use GET CONFIGURATION
637+
* features (CDC_MRW_W, CDC_RAM) must have called
638+
* cdrom_probe_write_features() before register_cdrom() so the mask is
639+
* complete here.
640+
*/
641+
set_disk_ro(disk, !CDROM_CAN(CDC_DVD_RAM | CDC_MRW_W | CDC_RAM |
642+
CDC_CD_RW));
643+
634644
cd_dbg(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
635645
mutex_lock(&cdrom_mutex);
636646
list_add(&cdi->list, &cdrom_list);
@@ -742,6 +752,44 @@ static int cdrom_is_random_writable(struct cdrom_device_info *cdi, int *write)
742752
return 0;
743753
}
744754

755+
/*
756+
* Probe write-related MMC features via GET CONFIGURATION and update
757+
* cdi->mask accordingly. Drivers that populate cdi->mask from the MODE SENSE
758+
* capabilities page (e.g. sr) should call this after those MODE SENSE bits
759+
* have been set but before register_cdrom(), so that the full set of
760+
* write-capability bits is known by the time register_cdrom() decides on the
761+
* initial read-only state of the disk.
762+
*/
763+
void cdrom_probe_write_features(struct cdrom_device_info *cdi)
764+
{
765+
int mrw, mrw_write, ram_write;
766+
767+
mrw = 0;
768+
if (!cdrom_is_mrw(cdi, &mrw_write))
769+
mrw = 1;
770+
771+
if (CDROM_CAN(CDC_MO_DRIVE))
772+
ram_write = 1;
773+
else
774+
(void) cdrom_is_random_writable(cdi, &ram_write);
775+
776+
if (mrw)
777+
cdi->mask &= ~CDC_MRW;
778+
else
779+
cdi->mask |= CDC_MRW;
780+
781+
if (mrw_write)
782+
cdi->mask &= ~CDC_MRW_W;
783+
else
784+
cdi->mask |= CDC_MRW_W;
785+
786+
if (ram_write)
787+
cdi->mask &= ~CDC_RAM;
788+
else
789+
cdi->mask |= CDC_RAM;
790+
}
791+
EXPORT_SYMBOL(cdrom_probe_write_features);
792+
745793
static int cdrom_media_erasable(struct cdrom_device_info *cdi)
746794
{
747795
disc_information di;
@@ -894,33 +942,8 @@ static int cdrom_is_dvd_rw(struct cdrom_device_info *cdi)
894942
*/
895943
static int cdrom_open_write(struct cdrom_device_info *cdi)
896944
{
897-
int mrw, mrw_write, ram_write;
898945
int ret = 1;
899946

900-
mrw = 0;
901-
if (!cdrom_is_mrw(cdi, &mrw_write))
902-
mrw = 1;
903-
904-
if (CDROM_CAN(CDC_MO_DRIVE))
905-
ram_write = 1;
906-
else
907-
(void) cdrom_is_random_writable(cdi, &ram_write);
908-
909-
if (mrw)
910-
cdi->mask &= ~CDC_MRW;
911-
else
912-
cdi->mask |= CDC_MRW;
913-
914-
if (mrw_write)
915-
cdi->mask &= ~CDC_MRW_W;
916-
else
917-
cdi->mask |= CDC_MRW_W;
918-
919-
if (ram_write)
920-
cdi->mask &= ~CDC_RAM;
921-
else
922-
cdi->mask |= CDC_RAM;
923-
924947
if (CDROM_CAN(CDC_MRW_W))
925948
ret = cdrom_mrw_open_write(cdi);
926949
else if (CDROM_CAN(CDC_DVD_RAM))

drivers/md/md-bitmap.c

Lines changed: 119 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ struct bitmap {
216216
};
217217

218218
static struct workqueue_struct *md_bitmap_wq;
219+
static struct attribute_group md_bitmap_internal_group;
219220

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

2584+
static bool bitmap_none_enabled(void *data, bool flush)
2585+
{
2586+
return false;
2587+
}
2588+
2589+
static int bitmap_none_create(struct mddev *mddev)
2590+
{
2591+
return 0;
2592+
}
2593+
2594+
static int bitmap_none_load(struct mddev *mddev)
2595+
{
2596+
return 0;
2597+
}
2598+
2599+
static void bitmap_none_destroy(struct mddev *mddev)
2600+
{
2601+
}
2602+
2603+
static int bitmap_none_get_stats(void *data, struct md_bitmap_stats *stats)
2604+
{
2605+
return -ENOENT;
2606+
}
2607+
25832608
static ssize_t
25842609
location_show(struct mddev *mddev, char *page)
25852610
{
@@ -2618,7 +2643,11 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
26182643
goto out;
26192644
}
26202645

2621-
bitmap_destroy(mddev);
2646+
sysfs_unmerge_group(&mddev->kobj, &md_bitmap_internal_group);
2647+
md_bitmap_destroy_nosysfs(mddev);
2648+
mddev->bitmap_id = ID_BITMAP_NONE;
2649+
if (!mddev_set_bitmap_ops_nosysfs(mddev))
2650+
goto none_err;
26222651
mddev->bitmap_info.offset = 0;
26232652
if (mddev->bitmap_info.file) {
26242653
struct file *f = mddev->bitmap_info.file;
@@ -2654,16 +2683,25 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
26542683
}
26552684

26562685
mddev->bitmap_info.offset = offset;
2657-
rv = bitmap_create(mddev);
2686+
md_bitmap_destroy_nosysfs(mddev);
2687+
mddev->bitmap_id = ID_BITMAP;
2688+
if (!mddev_set_bitmap_ops_nosysfs(mddev))
2689+
goto bitmap_err;
2690+
2691+
rv = md_bitmap_create_nosysfs(mddev);
26582692
if (rv)
2659-
goto out;
2693+
goto create_err;
26602694

2661-
rv = bitmap_load(mddev);
2695+
rv = mddev->bitmap_ops->load(mddev);
26622696
if (rv) {
26632697
mddev->bitmap_info.offset = 0;
2664-
bitmap_destroy(mddev);
2665-
goto out;
2698+
goto load_err;
26662699
}
2700+
2701+
rv = sysfs_merge_group(&mddev->kobj,
2702+
&md_bitmap_internal_group);
2703+
if (rv)
2704+
goto merge_err;
26672705
}
26682706
}
26692707
if (!mddev->external) {
@@ -2679,6 +2717,22 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
26792717
if (rv)
26802718
return rv;
26812719
return len;
2720+
2721+
merge_err:
2722+
mddev->bitmap_info.offset = 0;
2723+
load_err:
2724+
md_bitmap_destroy_nosysfs(mddev);
2725+
create_err:
2726+
mddev->bitmap_info.offset = 0;
2727+
mddev->bitmap_id = ID_BITMAP_NONE;
2728+
if (!mddev_set_bitmap_ops_nosysfs(mddev))
2729+
rv = -ENOENT;
2730+
goto out;
2731+
bitmap_err:
2732+
rv = -ENOENT;
2733+
none_err:
2734+
mddev->bitmap_info.offset = 0;
2735+
goto out;
26822736
}
26832737

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

2958-
static struct attribute *md_bitmap_attrs[] = {
3012+
static struct attribute *md_bitmap_common_attrs[] = {
29593013
&bitmap_location.attr,
3014+
NULL
3015+
};
3016+
3017+
static struct attribute *md_bitmap_internal_attrs[] = {
29603018
&bitmap_space.attr,
29613019
&bitmap_timeout.attr,
29623020
&bitmap_backlog.attr,
@@ -2967,9 +3025,41 @@ static struct attribute *md_bitmap_attrs[] = {
29673025
NULL
29683026
};
29693027

2970-
static struct attribute_group md_bitmap_group = {
3028+
static struct attribute_group md_bitmap_common_group = {
29713029
.name = "bitmap",
2972-
.attrs = md_bitmap_attrs,
3030+
.attrs = md_bitmap_common_attrs,
3031+
};
3032+
3033+
static struct attribute_group md_bitmap_internal_group = {
3034+
.name = "bitmap",
3035+
.attrs = md_bitmap_internal_attrs,
3036+
};
3037+
3038+
static const struct attribute_group *bitmap_groups[] = {
3039+
&md_bitmap_common_group,
3040+
&md_bitmap_internal_group,
3041+
NULL,
3042+
};
3043+
3044+
static const struct attribute_group *bitmap_none_groups[] = {
3045+
&md_bitmap_common_group,
3046+
NULL,
3047+
};
3048+
3049+
static struct bitmap_operations bitmap_none_ops = {
3050+
.head = {
3051+
.type = MD_BITMAP,
3052+
.id = ID_BITMAP_NONE,
3053+
.name = "none",
3054+
},
3055+
3056+
.enabled = bitmap_none_enabled,
3057+
.create = bitmap_none_create,
3058+
.load = bitmap_none_load,
3059+
.destroy = bitmap_none_destroy,
3060+
.get_stats = bitmap_none_get_stats,
3061+
3062+
.groups = bitmap_none_groups,
29733063
};
29743064

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

3016-
.group = &md_bitmap_group,
3106+
.groups = bitmap_groups,
30173107
};
30183108

30193109
int md_bitmap_init(void)
30203110
{
3111+
int err;
3112+
30213113
md_bitmap_wq = alloc_workqueue("md_bitmap", WQ_MEM_RECLAIM | WQ_UNBOUND,
30223114
0);
30233115
if (!md_bitmap_wq)
30243116
return -ENOMEM;
30253117

3026-
return register_md_submodule(&bitmap_ops.head);
3118+
err = register_md_submodule(&bitmap_none_ops.head);
3119+
if (err)
3120+
goto err_wq;
3121+
3122+
err = register_md_submodule(&bitmap_ops.head);
3123+
if (err)
3124+
goto err_none;
3125+
3126+
return 0;
3127+
3128+
err_none:
3129+
unregister_md_submodule(&bitmap_none_ops.head);
3130+
err_wq:
3131+
destroy_workqueue(md_bitmap_wq);
3132+
return err;
30273133
}
30283134

30293135
void md_bitmap_exit(void)
30303136
{
3031-
destroy_workqueue(md_bitmap_wq);
30323137
unregister_md_submodule(&bitmap_ops.head);
3138+
unregister_md_submodule(&bitmap_none_ops.head);
3139+
destroy_workqueue(md_bitmap_wq);
30333140
}

drivers/md/md-bitmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct bitmap_operations {
125125
void (*set_pages)(void *data, unsigned long pages);
126126
void (*free)(void *data);
127127

128-
struct attribute_group *group;
128+
const struct attribute_group **groups;
129129
};
130130

131131
/* the bitmap API */

drivers/md/md-llbitmap.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,11 @@ static struct attribute_group md_llbitmap_group = {
17381738
.attrs = md_llbitmap_attrs,
17391739
};
17401740

1741+
static const struct attribute_group *md_llbitmap_groups[] = {
1742+
&md_llbitmap_group,
1743+
NULL,
1744+
};
1745+
17411746
static struct bitmap_operations llbitmap_ops = {
17421747
.head = {
17431748
.type = MD_BITMAP,
@@ -1774,7 +1779,7 @@ static struct bitmap_operations llbitmap_ops = {
17741779
.dirty_bits = llbitmap_dirty_bits,
17751780
.write_all = llbitmap_write_all,
17761781

1777-
.group = &md_llbitmap_group,
1782+
.groups = md_llbitmap_groups,
17781783
};
17791784

17801785
int md_llbitmap_init(void)

0 commit comments

Comments
 (0)