1

nvme fix for Linux 6.13

- Use correct list traversal for srcu lists (Breno)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE3Fbyvv+648XNRdHTPe3zGtjzRgkFAmctGu8ACgkQPe3zGtjz
 RgkLZBAA3Ew8L7e6K2DwR+ppVw2wItifdpfpN8+/DEyBX7H/dvfyCNWhu2TG4txA
 maD2Or/UBOgeUHhWyQIl8Lhb8n+7bcCbDuSDuEp+rLE0R8pYex7CWB8T+mgQqQFS
 sy9r3VVhAgAoGugSa7VoIsm1cuIyly1kMb+IacyRxkf6J5n9YKsk1S3AcxHqMBkk
 58kNkDlemqhg2V43SKDr4CjwXBBe7Oydy2wErrb2PJwzdLgIbwnbuqzoblbzQXGo
 42/jdBNAFT+Eqd0SVHoi/nnDTZcNpRCkiRs6e1C0Dp27f95neaFhjNaExZQSPZuP
 uTJiGoGyrxZuBZ/QTfP679ZAs9UE4m0VU2niUjBn/bmJyZcxeLVfQRGFEwVdQ2YR
 jB79K5wQcVoYJ7xYlGQ7UOIT3lnem7AW1cPMxcnoqKcv6mEQX9YUl14o5Wxey8+3
 TMFrUUbZoEQp8kV+v45sOhmI5CFDCooulg006uRYS7tnfq9la7N3fY9LlpJoPz0Q
 sXgRZht8w71OtzodizuPZ7vfnzYy5Ed0qQJHZzYd4gH+VJapSqTdfCNiHETAADjF
 9L+fjPgSkSylZspUB7AzzmFl0EBXC2/Qse9S8hJPDpXD/N8ByV2X+TK+xg3hd2wB
 UjhwgoRHRO452C/Wmw7HqX/OxGJQNebfXxKl+79IMXLdnqbR0hs=
 =k2os
 -----END PGP SIGNATURE-----

Merge tag 'nvme-6.12-2024-11-07' of git://git.infradead.org/nvme into block-6.12

Pull NVMe fix from Keith:

"nvme fix for Linux 6.13

 - Use correct list traversal for srcu lists (Breno)"

* tag 'nvme-6.12-2024-11-07' of git://git.infradead.org/nvme:
  nvme/host: Fix RCU list traversal to use SRCU primitive
This commit is contained in:
Jens Axboe 2024-11-07 13:57:12 -07:00
commit 52ff8e91f9

View File

@ -3795,7 +3795,8 @@ struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid)
int srcu_idx;
srcu_idx = srcu_read_lock(&ctrl->srcu);
list_for_each_entry_rcu(ns, &ctrl->namespaces, list) {
list_for_each_entry_srcu(ns, &ctrl->namespaces, list,
srcu_read_lock_held(&ctrl->srcu)) {
if (ns->head->ns_id == nsid) {
if (!nvme_get_ns(ns))
continue;
@ -4879,7 +4880,8 @@ void nvme_mark_namespaces_dead(struct nvme_ctrl *ctrl)
int srcu_idx;
srcu_idx = srcu_read_lock(&ctrl->srcu);
list_for_each_entry_rcu(ns, &ctrl->namespaces, list)
list_for_each_entry_srcu(ns, &ctrl->namespaces, list,
srcu_read_lock_held(&ctrl->srcu))
blk_mark_disk_dead(ns->disk);
srcu_read_unlock(&ctrl->srcu, srcu_idx);
}
@ -4891,7 +4893,8 @@ void nvme_unfreeze(struct nvme_ctrl *ctrl)
int srcu_idx;
srcu_idx = srcu_read_lock(&ctrl->srcu);
list_for_each_entry_rcu(ns, &ctrl->namespaces, list)
list_for_each_entry_srcu(ns, &ctrl->namespaces, list,
srcu_read_lock_held(&ctrl->srcu))
blk_mq_unfreeze_queue(ns->queue);
srcu_read_unlock(&ctrl->srcu, srcu_idx);
clear_bit(NVME_CTRL_FROZEN, &ctrl->flags);
@ -4904,7 +4907,8 @@ int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
int srcu_idx;
srcu_idx = srcu_read_lock(&ctrl->srcu);
list_for_each_entry_rcu(ns, &ctrl->namespaces, list) {
list_for_each_entry_srcu(ns, &ctrl->namespaces, list,
srcu_read_lock_held(&ctrl->srcu)) {
timeout = blk_mq_freeze_queue_wait_timeout(ns->queue, timeout);
if (timeout <= 0)
break;
@ -4920,7 +4924,8 @@ void nvme_wait_freeze(struct nvme_ctrl *ctrl)
int srcu_idx;
srcu_idx = srcu_read_lock(&ctrl->srcu);
list_for_each_entry_rcu(ns, &ctrl->namespaces, list)
list_for_each_entry_srcu(ns, &ctrl->namespaces, list,
srcu_read_lock_held(&ctrl->srcu))
blk_mq_freeze_queue_wait(ns->queue);
srcu_read_unlock(&ctrl->srcu, srcu_idx);
}
@ -4933,7 +4938,8 @@ void nvme_start_freeze(struct nvme_ctrl *ctrl)
set_bit(NVME_CTRL_FROZEN, &ctrl->flags);
srcu_idx = srcu_read_lock(&ctrl->srcu);
list_for_each_entry_rcu(ns, &ctrl->namespaces, list)
list_for_each_entry_srcu(ns, &ctrl->namespaces, list,
srcu_read_lock_held(&ctrl->srcu))
blk_freeze_queue_start(ns->queue);
srcu_read_unlock(&ctrl->srcu, srcu_idx);
}
@ -4981,7 +4987,8 @@ void nvme_sync_io_queues(struct nvme_ctrl *ctrl)
int srcu_idx;
srcu_idx = srcu_read_lock(&ctrl->srcu);
list_for_each_entry_rcu(ns, &ctrl->namespaces, list)
list_for_each_entry_srcu(ns, &ctrl->namespaces, list,
srcu_read_lock_held(&ctrl->srcu))
blk_sync_queue(ns->queue);
srcu_read_unlock(&ctrl->srcu, srcu_idx);
}