OpenCloudOS-Kernel/drivers/nvme/target
Chaitanya Kulkarni 608a969046 nvmet: fix inline bio check for bdev-ns
When handling rw commands, for inline bio case we only consider
transfer size. This works well when req->sg_cnt fits into the
req->inline_bvec, but it will result in the warning in
__bio_add_page() when req->sg_cnt > NVMET_MAX_INLINE_BVEC.

Consider an I/O size 32768 and first page is not aligned to the page
boundary, then I/O is split in following manner :-

[ 2206.256140] nvmet: sg->length 3440 sg->offset 656
[ 2206.256144] nvmet: sg->length 4096 sg->offset 0
[ 2206.256148] nvmet: sg->length 4096 sg->offset 0
[ 2206.256152] nvmet: sg->length 4096 sg->offset 0
[ 2206.256155] nvmet: sg->length 4096 sg->offset 0
[ 2206.256159] nvmet: sg->length 4096 sg->offset 0
[ 2206.256163] nvmet: sg->length 4096 sg->offset 0
[ 2206.256166] nvmet: sg->length 4096 sg->offset 0
[ 2206.256170] nvmet: sg->length 656 sg->offset 0

Now the req->transfer_size == NVMET_MAX_INLINE_DATA_LEN i.e. 32768, but
the req->sg_cnt is (9) > NVMET_MAX_INLINE_BIOVEC which is (8).
This will result in the following warning message :-

nvmet_bdev_execute_rw()
	bio_add_page()
		__bio_add_page()
			WARN_ON_ONCE(bio_full(bio, len));

This scenario is very hard to reproduce on the nvme-loop transport only
with rw commands issued with the passthru IOCTL interface from the host
application and the data buffer is allocated with the malloc() and not
the posix_memalign().

Fixes: 73383adfad ("nvmet: don't split large I/Os unconditionally")
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-05-11 18:30:45 +02:00
..
Kconfig nvmet: fix a spelling mistake "incuding" -> "including" in Kconfig 2020-12-01 20:36:37 +01:00
Makefile nvmet: add passthru code to process commands 2020-07-29 07:45:21 +02:00
admin-cmd.c nvmet: remove unsupported command noise 2021-05-04 09:39:26 +02:00
configfs.c nvmet: fix a spelling mistake "nubmer" -> "number" 2021-04-15 08:12:53 +02:00
core.c for-5.13/drivers-2021-04-27 2021-04-28 14:39:37 -07:00
discovery.c nvmet: return proper error code from discovery ctrl 2021-04-02 18:48:28 +02:00
fabrics-cmd.c nvmet: remove unnecessary ctrl parameter 2021-04-02 18:48:27 +02:00
fc.c nvmet-fc: simplify nvmet_fc_alloc_hostport 2021-04-15 08:12:53 +02:00
fcloop.c nvme: constify static attribute_group structs 2021-02-02 10:26:10 +01:00
io-cmd-bdev.c nvmet: fix inline bio check for bdev-ns 2021-05-11 18:30:45 +02:00
io-cmd-file.c nvmet: use invalid cmd opcode helper 2021-02-10 16:38:05 +01:00
loop.c nvme: move the fabrics queue ready check routines to core 2021-05-04 09:35:49 +02:00
nvmet.h nvmet: fix inline bio check for bdev-ns 2021-05-11 18:30:45 +02:00
passthru.c block: rename BIO_MAX_PAGES to BIO_MAX_VECS 2021-03-11 07:47:48 -07:00
rdma.c nvme-rdma: Fix a use after free in nvmet_rdma_write_data_done 2021-03-11 11:48:35 +01:00
tcp.c for-5.13/drivers-2021-04-27 2021-04-28 14:39:37 -07:00
trace.c nvmet: trace: parse Get LBA Status command in detail 2019-08-29 12:55:01 -07:00
trace.h nvmet: use min of device_path and disk len 2021-02-10 16:38:05 +01:00