[PATCH] nvme: Fix zns drives without append support to export correct permissions
Adam Manzanares
a.manzanares at samsung.com
Fri Mar 11 12:49:13 PST 2022
On Fri, Mar 11, 2022 at 09:16:08PM +0100, Pankaj Raghav wrote:
> This commit 2f4c9ba23b88 ("nvme: export zoned namespaces without Zone
> Append support read-only") exported zoned namespaces without append support
> to be marked as ro. It does it by setting NVME_NS_FORCE_RO to the
> ns->flags in nvme_update_zone_info and later nvme_update_disk_info will
> check for this flag and set the disk as ro.
>
> But later this commit 73d90386b559 ("nvme: cleanup zone information
> initialization") rearranged nvme_update_disk_info to be called before
> nvme_update_zone_info thereby not marking the disk as ro. The call order
> cannot be just reverted because nvme_update_zone_info sets certain queue
> parameters such as zone_write_granularity that depend on the prior call
> to nvme_update_disk_info.
>
> Call nvme_update_disk_info after nvme_update_zone_info again so that the
> permission for ZNS drives are marked correctly.
>
> Fixes: 73d90386b559 ("nvme: cleanup zone information initialization")
> Signed-off-by: Pankaj Raghav <p.raghav at samsung.com>
> ---
> drivers/nvme/host/core.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 51c08f206cbf..67a78653b07c 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1913,6 +1913,11 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
> ret = nvme_update_zone_info(ns, lbaf);
> if (ret)
> goto out_unfreeze;
> + /* nvme_update_zone_info might set the namespace to be marked
> + * as read-only. Call nvme_update_disk_info so that the disk
> + * is updated with the appropriate permission.
> + */
> + nvme_update_disk_info(ns->disk, ns, id);
Shouldn't we make this conditional?
> }
>
> set_bit(NVME_NS_READY, &ns->flags);
> --
> 2.25.1
>
More information about the Linux-nvme
mailing list