Re: [PATCH v2] nvmet-file: fix nvmet_file_flush() always returning an error

From: Chaitanya Kulkarni
Date: Wed Jul 17 2019 - 14:35:36 EST


On 07/15/2019 03:17 PM, Logan Gunthorpe wrote:
> Presently, nvmet_file_flush() always returns a call to
> errno_to_nvme_status() but that helper doesn't take into account the
> case when errno=0. So nvmet_file_flush() always returns an error code.
>
> All other callers of errno_to_nvme_status() check for success before
> calling it.
>
> To fix this, ensure errno_to_nvme_status() returns success if the
> errno is zero. This should prevent future mistakes like this from
> happening.
>
> Fixes: c6aa3542e010 ("nvmet: add error log support for file backend")
> Signed-off-by: Logan Gunthorpe<logang@xxxxxxxxxxxx>
> Cc: Chaitanya Kulkarni<chaitanya.kulkarni@xxxxxxx>

Thanks for the fix Logan, errno_to_nvme_status() needs to be only called
in the case of error. Clearly bad example of calling function withing
function.

Looks good to me.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>