Re: [PATCH v4 3/5] nvmet: return DHCHAP status codes from nvmet_setup_auth()

From: Daniel Wagner
Date: Fri Apr 05 2024 - 09:25:32 EST


On Fri, Apr 05, 2024 at 12:02:52PM +0200, Daniel Wagner wrote:
> On Fri, Apr 05, 2024 at 08:20:55AM +0200, Christoph Hellwig wrote:
> > > @@ -131,7 +131,6 @@ int nvmet_setup_auth(struct nvmet_ctrl *ctrl)
> > > int ret = 0;
> > > struct nvmet_host_link *p;
> > > struct nvmet_host *host = NULL;
> > > - const char *hash_name;
> > >
> > > down_read(&nvmet_config_sem);
> > > if (nvmet_is_disc_subsys(ctrl->subsys))
> > > @@ -149,13 +148,16 @@ int nvmet_setup_auth(struct nvmet_ctrl *ctrl)
> > > }
> > > if (!host) {
> > > pr_debug("host %s not found\n", ctrl->hostnqn);
> > > - ret = -EPERM;
> > > + ret = NVME_AUTH_DHCHAP_FAILURE_FAILED;
> > > goto out_unlock;
> >
> > This is now returning returning random on the wire fields that aren't
> > even the NVMe status codes from a function otherwise returning Linux
> > errno values. I can't see how this works or is maintainable long term.
>
> This is the target side and we generate the on wire return code here.
> Are you sure I should map this to errno codes and the back to NVME
> status codes? Sure, this is possible but don't really think it makes
> sense.

I think I start to understand your feedback. I'll try to address it.