linux/drivers/nvme/target
Minwoo Im 3562f5d9f2 nvmet: fix data_len to 0 for bdev-backed write_zeroes
The WRITE ZEROES command has no data transfer so that we need to
initialize the struct (nvmet_req *req)->data_len to 0x0.  While
(nvmet_req *req)->transfer_len is initialized in nvmet_req_init(),
data_len will be initialized by nowhere which might cause the failure
with status code NVME_SC_SGL_INVALID_DATA | NVME_SC_DNR randomly.  It's
because nvmet_req_execute() checks like:

	if (unlikely(req->data_len != req->transfer_len)) {
		req->error_loc = offsetof(struct nvme_common_command, dptr);
		nvmet_req_complete(req, NVME_SC_SGL_INVALID_DATA | NVME_SC_DNR);
	} else
		req->execute(req);

This patch fixes req->data_len not to be a randomly assigned by
initializing it to 0x0 when preparing the command in
nvmet_bdev_parse_io_cmd().

nvmet_file_parse_io_cmd() which is for file-backed I/O has already
initialized the data_len field to 0x0, though.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
2019-06-04 09:29:31 -07:00
..
admin-cmd.c nvmet: fix discover log page when offsets are used 2019-04-11 17:28:30 +02:00
configfs.c nvmet: return a specified error it subsys_alloc fails 2019-04-25 16:41:26 +02:00
core.c nvmet: include <linux/scatterlist.h> 2019-04-25 16:47:03 +02:00
discovery.c nvmet: protect discovery change log event list iteration 2019-05-01 09:18:47 -04:00
fabrics-cmd.c nvmet: rename nvme_completion instances from rsp to cqe 2019-04-25 16:41:26 +02:00
fc.c nvmet: rename nvme_completion instances from rsp to cqe 2019-04-25 16:41:26 +02:00
fcloop.c nvmet-fcloop: convert to SPDX identifiers 2019-02-20 07:22:34 -07:00
io-cmd-bdev.c nvmet: fix data_len to 0 for bdev-backed write_zeroes 2019-06-04 09:29:31 -07:00
io-cmd-file.c nvmet-file: clamp-down file namespace lba_shift 2019-04-25 16:51:19 +02:00
Kconfig nvmet: include <linux/scatterlist.h> 2019-04-25 16:47:03 +02:00
loop.c nvme-loop: kill timeout handler 2019-04-25 16:51:41 +02:00
Makefile nvmet-tcp: add NVMe over TCP target driver 2018-12-13 09:58:57 +01:00
nvmet.h nvmet: rename nvme_completion instances from rsp to cqe 2019-04-25 16:41:26 +02:00
rdma.c nvmet: rename nvme_completion instances from rsp to cqe 2019-04-25 16:41:26 +02:00
tcp.c nvmet-tcp: don't fail maxr2t greater than 1 2019-04-25 16:51:19 +02:00