Spdk/lib/bdev
Shuhei Matsumoto 4b92ffb3f1 bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb
When the specified buffer size to spdk_bdev_io_get_buf() is greater
than the permitted maximum, spdk_bdev_io_get_buf() asserts simply and
doesn't call the specified callback function.

SPDK SCSI library doesn't allocate read buffer and specifies
expected read buffer size, and expects that it is allocated by
spdk_bdev_io_get_buf().

Bdev perf tool also doesn't allocate read buffer and specifies
expected read buffer size, and expects that it is allocated by
spdk_bdev_io_get_buf().

When we support DIF insert and strip in iSCSI target, the read
buffer size iSCSI initiator requests and the read buffer size iSCSI target
requests will become different.

Even after that, iSCSI initiator and iSCSI target will negotiate correctly
not to cause buffer overflow in spdk_bdev_io_get_buf(), but if iSCSI
initiator ignores the result of negotiation, iSCSI initiator can request
read buffer size larger than the permitted maximum, and can cause
failure in iSCSI target. This is very flagile and should be avoided.

This patch do the following
- Add the completion status of spdk_bdev_io_get_buf() to
  spdk_bdev_io_get_buf_cb(),
- spdk_bdev_io_get_buf() calls spdk_bdev_io_get_buf_cb() by setting
  success to false, and return.
- spdk_bdev_io_get_buf_cb() in each bdev module calls assert if success
  is false.

Subsequent patches will process the case that success is false
in spdk_bdev_io_get_buf_cb().

Change-Id: I76429a86e18a69aa085a353ac94743296d270b82
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/446045
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-02-27 01:59:11 +00:00
..
aio bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
crypto bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
error bdev: make spdk_bdev_register_module_xxx function names predictable 2019-02-11 23:56:53 +00:00
ftl bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
gpt bdev: make spdk_bdev_register_module_xxx function names predictable 2019-02-11 23:56:53 +00:00
iscsi bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
lvol bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
malloc bdev: make spdk_bdev_register_module_xxx function names predictable 2019-02-11 23:56:53 +00:00
null bdev: make spdk_bdev_register_module_xxx function names predictable 2019-02-11 23:56:53 +00:00
nvme bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
ocf bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
passthru bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
pmem bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
raid bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
rbd bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
rpc lib/bdev: Expose enabled DIF check types of bdev. 2019-02-08 23:37:13 +00:00
split bdev: make spdk_bdev_register_module_xxx function names predictable 2019-02-11 23:56:53 +00:00
virtio bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
bdev.c bdev: Not assert but pass completion status to spdk_bdev_io_get_buf_cb 2019-02-27 01:59:11 +00:00
Makefile OCF: add OCF module 2019-01-28 09:41:52 +00:00
part.c bdev: Improve spdk_bdev_open() to print string describing error number 2019-01-24 10:50:34 +00:00
scsi_nvme.c bdev: move error union to internal spdk_bdev_io struct 2018-06-26 20:04:07 +00:00
vtune.c mk: don't use '-include spdk/config.h' 2018-10-02 23:13:32 +00:00