[PATCH] nvme: fix SRCU protection of nvme_ns_head list
Christoph Hellwig
hch at lst.de
Sun Nov 20 23:40:39 PST 2022
On Sun, Nov 20, 2022 at 01:24:51PM +0200, Sagi Grimberg wrote:
>> sector_t capacity = get_capacity(head->disk);
>> int node;
>> + int srcu_idx;
>> + srcu_idx = srcu_read_lock(&head->srcu);
>> list_for_each_entry_rcu(ns, &head->list, siblings) {
>> if (capacity != get_capacity(ns->disk))
>> clear_bit(NVME_NS_READY, &ns->flags);
>> }
>> + srcu_read_unlock(&head->srcu, srcu_idx);
>
> I don't think you need srcu here, rcu_read_lock/unlock is sufficient.
So the code obviously does not sleep. But I wonder if anything speaks
against mixing SRCU and RCU protection for the same list?
More information about the Linux-nvme
mailing list