[PATCH 1/2] nvme: make NVMe freeze API reliably
Keith Busch
kbusch at kernel.org
Wed Aug 24 07:07:03 PDT 2022
On Wed, Aug 24, 2022 at 01:15:28PM +0200, Hannes Reinecke wrote:
> On 8/21/22 10:47, Ming Lei wrote:
> > @@ -5065,8 +5073,10 @@ void nvme_start_freeze(struct nvme_ctrl *ctrl)
> > struct nvme_ns *ns;
> > down_read(&ctrl->namespaces_rwsem);
> > - list_for_each_entry(ns, &ctrl->namespaces, list)
> > + list_for_each_entry(ns, &ctrl->namespaces, list) {
> > + set_bit(NVME_NS_FREEZE, &ns->flags);
>
> Why not test_and_set_bit()?
> Which would have the nice effect of adding a memory barrier ...
Sure, I think you can even make a new WARN if the test fails. It should never
fail in this path, otherwise we could mess up the freeze depth.
More information about the Linux-nvme
mailing list