Skip to content

Commit ac229a2

Browse files
Christoph Hellwigkeithbusch
authored andcommitted
nvme-multipath: don't inherit LBA-related fields for the multipath node
Linux 6.9 made the nvme multipath nodes not properly pick up changes when the LBA size goes smaller after an nvme format. This is because we now try to inherit the queue settings for the multipath node entirely from the individual paths. That is the right thing to do for I/O size limitations, which make up most of the queue limits, but it is wrong for changes to the namespace configuration, where we do want to pick up the new format, which will eventually show up on all paths once they are re-queried. Fix this by not inheriting the block size and related fields and always for updating them. Fixes: 8f03cfa ("nvme: don't use nvme_update_disk_info for the multipath disk") Reported-by: Nilay Shroff <[email protected]> Tested-by: Nilay Shroff <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 22d24a5 commit ac229a2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/nvme/host/core.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,6 +2201,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
22012201
}
22022202

22032203
if (!ret && nvme_ns_head_multipath(ns->head)) {
2204+
struct queue_limits *ns_lim = &ns->disk->queue->limits;
22042205
struct queue_limits lim;
22052206

22062207
blk_mq_freeze_queue(ns->head->disk->queue);
@@ -2212,7 +2213,26 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
22122213
set_disk_ro(ns->head->disk, nvme_ns_is_readonly(ns, info));
22132214
nvme_mpath_revalidate_paths(ns);
22142215

2216+
/*
2217+
* queue_limits mixes values that are the hardware limitations
2218+
* for bio splitting with what is the device configuration.
2219+
*
2220+
* For NVMe the device configuration can change after e.g. a
2221+
* Format command, and we really want to pick up the new format
2222+
* value here. But we must still stack the queue limits to the
2223+
* least common denominator for multipathing to split the bios
2224+
* properly.
2225+
*
2226+
* To work around this, we explicitly set the device
2227+
* configuration to those that we just queried, but only stack
2228+
* the splitting limits in to make sure we still obey possibly
2229+
* lower limitations of other controllers.
2230+
*/
22152231
lim = queue_limits_start_update(ns->head->disk->queue);
2232+
lim.logical_block_size = ns_lim->logical_block_size;
2233+
lim.physical_block_size = ns_lim->physical_block_size;
2234+
lim.io_min = ns_lim->io_min;
2235+
lim.io_opt = ns_lim->io_opt;
22162236
queue_limits_stack_bdev(&lim, ns->disk->part0, 0,
22172237
ns->head->disk->disk_name);
22182238
ret = queue_limits_commit_update(ns->head->disk->queue, &lim);

0 commit comments

Comments
 (0)