]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet-file: fix nvmet_file_flush() always returning an error
authorLogan Gunthorpe <logang@deltatee.com>
Wed, 31 Jul 2019 23:35:33 +0000 (17:35 -0600)
committerSagi Grimberg <sagi@grimberg.me>
Thu, 1 Aug 2019 00:57:21 +0000 (17:57 -0700)
commit4925551c064197eb1a923e7cbddde0621d65d656
tree143bf8acdebccf6d87b8c113fb2ec2d11fce3378
parent26a40836ae4df960337f024a821ea5075ec20230
nvmet-file: fix nvmet_file_flush() always returning an error

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: 8587ba99c177 ("nvmet: add error log support for file backend")
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/target/core.c