From 9e1116ea8314dcb500c027aadc8c50a9ca4becd7 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 25 Apr 2019 15:24:34 -0700 Subject: [PATCH] blob: pass correct op to spdk_bs_user_op_alloc in iov case At some point this parameter may have been a bool, but it's not now - so we need to explicitly pass SPDK_BLOB_READV or SPDK_BLOB_WRITEV. Otherwise we end up trying to write the iovec array as the data buffer when executing this operation later - since we passed "false" which is treated as 0 which is SPDK_BLOB_WRITE (not SPDK_BLOB_WRITEV). Fixes issue #603. Signed-off-by: Jim Harris Change-Id: I50df736216c4a88b40604722c021e204c7fac623 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452157 Reviewed-by: Changpeng Liu Reviewed-by: Tomasz Zawadzki Reviewed-by: Darek Stojaczyk Tested-by: SPDK CI Jenkins --- lib/blob/blobstore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 7f4f22667..fbd0ddfcb 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -2114,10 +2114,12 @@ _spdk_blob_request_submit_rw_iov(struct spdk_blob *blob, struct spdk_io_channel cpl.u.blob_basic.cb_arg = cb_arg; if (blob->frozen_refcnt) { /* This blob I/O is frozen */ + enum spdk_blob_op_type op_type; spdk_bs_user_op_t *op; struct spdk_bs_channel *bs_channel = spdk_io_channel_get_ctx(_channel); - op = spdk_bs_user_op_alloc(_channel, &cpl, read, blob, iov, iovcnt, offset, length); + op_type = read ? SPDK_BLOB_READV : SPDK_BLOB_WRITEV; + op = spdk_bs_user_op_alloc(_channel, &cpl, op_type, blob, iov, iovcnt, offset, length); if (!op) { cb_fn(cb_arg, -ENOMEM); return;