Commit 73edfc05 authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Konrad Sztyber
Browse files

lib/bdev: Reset split flag when bounce buffer is used



When read/write IO is sbumitted, we check if IO needs
to be split. That might be true if iovcnt exceeds bdev's
max_sge. However, if memory domain and/or accel sequence
are used, we use a staging buffer and set iovcnt to 1.
In that case no split might be longer required but since
the split flag is still set, we may attempt to split IO,
that leads to some weird results or hit an assert in
debug build.
To fix it, reset split flag once staging buffer is
allocated

Signed-off-by: default avatarAlexey Marchuk <alexeymar@nvidia.com>
Change-Id: Ib8a74abbb9e3449ce3e34efd744d3a19623e6815
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24467


Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent afcb180b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -438,6 +438,8 @@ static void claim_reset(struct spdk_bdev *bdev);

static void bdev_ch_retry_io(struct spdk_bdev_channel *bdev_ch);

static bool bdev_io_should_split(struct spdk_bdev_io *bdev_io);

#define bdev_get_ext_io_opt(opts, field, defval) \
	((opts) != NULL ? SPDK_GET_FIELD(opts, field, defval) : (defval))

@@ -1368,6 +1370,8 @@ _bdev_io_pull_bounce_data_buf(struct spdk_bdev_io *bdev_io, void *buf, size_t le
	/* set bounce buffer for this operation */
	bdev_io->u.bdev.iovs[0].iov_base = buf;
	bdev_io->u.bdev.iovs[0].iov_len = len;
	/* Now we use 1 iov, the split condition could have been changed */
	bdev_io->internal.f.split = bdev_io_should_split(bdev_io);

	if (spdk_unlikely(!TAILQ_EMPTY(&shared_resource->nomem_io))) {
		bdev_queue_nomem_io_tail(shared_resource, bdev_io, BDEV_IO_RETRY_STATE_PULL);