[PATCH 4/4] nvme: check that EUI/GUID/UUID are globally unique
Christoph Hellwig
hch at lst.de
Wed Jun 8 00:52:52 PDT 2022
On Mon, Jun 06, 2022 at 08:35:39PM +0000, Alan Adamson wrote:
> nvme driver changes:
Thanks!
>
> ret = nvme_global_check_duplicate_ids(ctrl->subsys, ids);
> if (ret) {
> - dev_err(ctrl->device,
> - "globally duplicate IDs for nsid %d\n", nsid);
> - return ret;
> + if (ctrl->opts && ctrl->opts->clear_ids) {
> + uuid_copy(&ids->uuid, &uuid_null);
> + memset(&ids->nguid, 0, sizeof(ids->nguid));
> + memset(&ids->eui64, 0, sizeof(ids->eui64));
> + } else {
> + dev_err(ctrl->device,
> + "globally duplicate IDs for nsid %d\n", nsid);
> + return ret;
> + }
I don't think this is the right place to clear the reported IDs.
The proper place would be in the target code in
nvmet_passthru_override_id_ns and a new
nvmet_passthru_override_id_ns_desc like it. Otherwise we only catch
the kernel driver uses and not other users of the IDs.
> @@ -593,6 +595,8 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
> }
> kfree(opts->transport);
> opts->transport = p;
> + if (!strcmp(p, "loop"))
> + opts->clear_ids = true;
And maybe add a comment here.
More information about the Linux-nvme
mailing list