Commit Graph

8218 Commits

Author SHA1 Message Date
Jim Harris
b282c927ea blobfs: track num outstanding requests per channel
This will be used in next patch to ensure synchronous
threads wait until any background operations are done
before freeing its request memory, and also to print
errors if internal channels have outstanding
requests when freed.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I24bc8096f84b70270f87b051f9034ed08e639500

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451780
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-23 23:38:29 +00:00
Tomasz Zawadzki
ae693db986 iscsi: fix memleak when iscsi_read_config_file_params() fails
All error paths must free opts->nodebase and opts->authfile.

Change-Id: I655f112dd36bbd0dca6050bc5cc3ade1a5b05b7d
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451770
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 22:05:22 +00:00
Ben Walker
598795ba97 nbd: Remove unused spdk_event forward declaration
Change-Id: Ic63aa31bc53a9c0741049ba7a156dab901c2283b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451759
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 20:22:55 +00:00
Ben Walker
5d0b5e2ce9 thread: Add cpumask parameter to spdk_thread_create
Allow users to optionally specify an affinity mask when
creating a thread. This isn't currently used, but we want
the API to be in its final form for the next release.

Change-Id: I7bd05e921ece6d8d5f61775bd14286f6a58f267f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451683
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 20:22:55 +00:00
Ben Walker
14bf912df9 bdevperf: Use new zcopy API for reads
Change-Id: I71023d56f9023f46ff65291d22b1b8d31595a7b5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/416579
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 18:38:39 +00:00
Ben Walker
946ef1dc47 bdev: Emulate zero copy support when necessary
For bdevs that don't support zero copy, emulate the
API using regular read and write operations.

Change-Id: Iabd7ff474bf740b096f38bd47196987cbd89e915
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/416465
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 18:38:39 +00:00
Ben Walker
7e4911c922 bdev: Make malloc bdev use the new zero copy mechanism
Change-Id: I8aea5dee3ad30814ffd061c4afa7729ad8d47cdf
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/386167
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 18:38:39 +00:00
Ben Walker
84850dacd7 bdev: Add a zero copy I/O path
Add a ZCOPY operation to obtain buffers that represent
data regions on the backing block device.

Change-Id: Ie941c16ee051d0009e3888b52b8f41773bba47b3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/386166
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 18:38:39 +00:00
Jim Harris
b92c3d412d nvmf: add tcp trace points for data read from socket
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib04abb64dd379dd73c7ff3c8318591124b4bb7dd

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451477
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-23 17:59:23 +00:00
Darek Stojaczyk
283abcb9a2 bdev: temporarily allow bdev descriptors to be closed from any thread
Bdev descriptors could be closed only from the same thread
that opened them. This restriction was suddenly introduced
at one point without making sure all the SPDK code respects
it. Vhost can still close descriptors from any arbitrary
thread and fixing that would require some more effort.

With this patch we remove the thread-specific assert from
spdk_bdev_close() and hence allow vhost to work properly
in debug builds. Vhost can still have a possible data
race with bdev hotremove notification, but let's get rid
of the abort() from the usual code path first.

Change-Id: I6fac66a5ebc907b1c5418fff618f0b64cd9b69f4
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451561
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 17:06:37 +00:00
Darek Stojaczyk
f93b6fb0a4 bdev: defer unregister untill *all* descriptors are closed
We used to wait only for those descriptors which
specified the hotremove notification callback. The
bdev could've been removed before the descriptor
was closed and the subsequent spdk_bdev_close would
simply segfault.

This patch modifies spdk_bdev_unregister to always
wait for all descriptors to be closed before actually
unregistering the bdev. This consolidates the bdev
unregister behavior for descriptors with and without
the hotremove callback.

Change-Id: I9b358209c6abd301b6fe8660e27bc6fa4ef485d6
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450175
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 17:06:37 +00:00
Gregory Shapiro
14032a984c NVMF: Add model number as parameter to construct_nvmf_subsystem (-d option).
Change-Id: Ia1a458a0ac1c5a17d2955a3f31c6dfe77538eb17
Signed-off-by: Gregory Shapiro <gregory.shapiro@kaminario.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/438562
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-23 16:51:16 +00:00
Changpeng Liu
68bb3995aa nvmf: trivial optimization to make the code more consistent
Make the use of spdk_uuid_compare() to be consistent in the file,
also change the SPDK_INFOLOG to SPDK_DEBUGLOG to avoid the
repeated log messages for RESERVATION CONFLICT response.

Change-Id: I72fefbd520cefcaf25182c3ca3d21e3d87d17e94
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450884
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-04-23 16:30:24 +00:00
Changpeng Liu
3b214eb8f3 UT/nvmf: add controller reservation notification log unit tests
Change-Id: I98dba9998e412db101437e9276648dac6eba2de5
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450490
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 16:30:24 +00:00
Changpeng Liu
4fa486a1e3 nvmf: add asynchronous event for reservation notificaiton
Now Host can get an asynchronous event notification when
registrants were unregistered/preempted or reservation was
released from the associate namespace, Host can send
get log page to clear related log pages and reservation
report to get the full overview of current reservation
configuration.

Change-Id: Idc57c19812490c7536503308989871515e9f2361
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/439935
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 16:30:24 +00:00
h00448672
dc61452d6e nvme: Modify the memory barrier mode to improve performance
The mode of dmb oshld can guarantees cpu sequential execution,
which has less impact on performance.

Change-Id: If30b6a682a2216eecd1da039267ed4f5471afc38
Signed-off-by: h00448672 <heyang18@huawei.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446827
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-23 14:32:44 +00:00
Amir More
9e2eb8cb51 blobstore: Swap cluster maps on snapshot instead of copying
Previously, when creating a snapshot in blobstore the snapshot's cluster map
was copied from the "original" blob, with the original's map zeroed. These
operations are both O(num_clusters*cluster_size/page_size) while io
operations are frozen. This change replaces the linear operation with an
O(1) pointer swap at the critical moment that io is frozen, while
doing the zeroing before the freeze when preparing the snapshot to
minimize freeze time.

Change-Id: I1e468bc97623f5da161a8ddba1393c271acd3aed
Signed-off-by: Amir More <habeanf@gmail.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451486
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-22 18:49:21 +00:00
jiaqizho
b70e698465 rdma:fix core dump when rdma_create_qp return error.
Signed-off-by: jiaqizho <jiaqi.zhou@intel.com>
Change-Id: Ie900e01820f69fc5b2d5e30d519c6b619d7a7281
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449507
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-22 18:40:35 +00:00
Piotr Pelplinski
26f3060348 notify: documentation
This patch adds notify.md file.

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: I65555d3e2cc8d8d616f56ca40e95d558e2654fb7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/435087
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-22 18:24:24 +00:00
Shuhei Matsumoto
56d8b78576 lib/scsi: Make spdk_scsi_dev_destruct asynchronous
This is the end of the patch series. After this patch,
delete_target_node RPC will wait for the completion of
removal of the SCSI device and then free the iSCSI target.

SCSI device holds passed callback and calls it in free_dev().
free_dev() is ensured to be called after all iSCSI sessions
are closed. So iSCSI target resource can be freed safely
after that.

Change-Id: I25921b4014207092b7b3845dfeae58bcdffa2edc
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450607
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-22 18:22:59 +00:00
Vitaliy Mysak
9e10f5fafa scripts: vm_setup.sh support INSTALL for Ubuntu
This commit adds functionality for installing most of the packages,
 which were previously installed for Fedora only,
 for Ubuntu as well

Some packages are not going to be installed by the script:
For ubuntu 16
  * libpmempool
  * open-isns-utils
  * perl-open
For ubuntu 18
  * perl-open

Remaining packages deserve their own patches since they are not so easy to
  install on Ubuntu

Change-Id: Ic5b744193ff4df46ab4e4fb3783e0515ccdbfecb
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/425388
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Paweł Niedźwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-04-22 16:52:56 +00:00
Darek Stojaczyk
6c17f696c1 vhost: allocate device objects with regular calloc
spdk_dma_malloc() is not required here, as the device
object is neither DMA-able nor shared between processes.

The device structures used to be aligned to cache line
size, but that's just a leftover from before sessions
were introduced. The device object is just a generic
device information that can be accessed from any thread
holding the proper mutex. The hot data used in the I/O
path sits in the session structure, which is now allocated
with posix_memalloc() to ensure proper alignment.

Vhost NVMe is an exception, as the device struct is used
as hot I/O data for the one and only session it supports,
so it's also allocated with posix_memalloc().

While here, also allocate various vhost buffers using
spdk_zmalloc() instead of spdk_dma_zmalloc(), as
spdk_dma_*malloc() is about to be deprecated.

Change-Id: Ic7f63185639b7b98dc1ef756166c826a0af87b44
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450551
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>
2019-04-22 16:50:37 +00:00
Darek Stojaczyk
12f622b769 virtio: zero-out virtqueue structures at init
They used to be allocated with spdk_dma_zmalloc() which did
provide zeroed memory, but we unintentionally changed that
when switching to posix_memalign.

The structure might have some unitialized memory, so with
this patch we just memset it right after allocating it.

Change-Id: Id5a5685e09419901513925abaeed605c36f5199a
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451546
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>
2019-04-22 16:49:39 +00:00
Changpeng Liu
fc45844cf5 blobfs: use wrapper function to free fs resources
Change-Id: Ia9c430c512e8c9a3195e2bfb28adb0526174070a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450982
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-22 16:48:08 +00:00
Changpeng Liu
1bc959f221 blobfs: fix up the wrong usage of delete API
blob_delete_cb() takes spdk_fs_request as the input
parameter.

Change-Id: Ie6150e7d31d187296a448e82784e2ac2fecfe52c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450895
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-22 16:48:08 +00:00
Changpeng Liu
2db7378273 blobfs: fix the wrong parameter usage for truncate API
fs_truncate_complete_cb() takes spdk_fs_request as
the input parameter.

Change-Id: I0413fecd30a1f7cb6528b502848fa999454ba638
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450891
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-22 16:48:08 +00:00
Changpeng Liu
ceb6ef8958 blobfs: add iov data structure to request
For existing filesystem APIs, SPDK can only support
1 data buffer, we add the iovec data structure here
so that it can support multiple buffer vectors in
following patches.

Change-Id: I26984f3ea985f349a5016060e0801e3989ce2fc6
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450722
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-22 16:48:08 +00:00
Jim Harris
65d9e4594a iscsi: suppress successful iscsi logout notifications
We did this a while ago for login notifications - do
it for logout as well.

While here, just use SPDK_DEBUGLOG instead of printing
to a buffer first.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I77f566d139cd818428371ec887efeca6eee08898
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451062
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-22 16:44:42 +00:00
Jim Harris
bde47b0e33 spdkcli: use items instead of iteritems for iSCSI connections
Without this, spdkcli crashes when refreshing if any iSCSI
connections are established.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I82cd7a98e8c7d48e4730a7bd228ed483bdac28ef

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451060
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-04-22 16:44:42 +00:00
Shuhei Matsumoto
9470d65e8d lib/scsi: Add lun to the names of descriptors and callback for LUN
The next patch will add the function ponter typedef
spdk_scsi_dev_destruct_cb for SCSI device destruction.
Hence add lun to the names of descriptors and callback for SCSI
LUN for clarification.

This patch doesn't change any behavior.

Change-Id: I73f2bce9129f7a6f16770ab6ed18428b16589108
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450883
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-04-22 16:00:42 +00:00
Shuhei Matsumoto
d039746c64 lib/iscsi: Make iscsi_tgt_node_destruct asynchronous
This patch changes iscsi_tgt_node_destruct to be asynchronous.

spdk_iscsi_shutdown_tgt_node_by_name() uses the callback
provided by iscsi_tgt_node_destruct(), but
spdk_iscsi_shutdown_tgt_nodes() doesn't use it.

The reason is that during shutdown all sessions are terminated
already, and spdk_iscsi_shutdown_tgt_nodes() doesn't need to
wait for the completion of iscsi_tgt_node_destruct() by using
the callback. iscsi_tgt_node_destruct() will complete immediately
in this case.

spdk_scsi_dev_destruct() is not asynchronized yet and so
iscsi_tgt_node_destruct() calls its callback directly in this patch.

The next patch will replace the call.

Change-Id: I86911c5297a93560551e0404d6ea85f49d647c22
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450606
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-04-22 16:00:42 +00:00
Shuhei Matsumoto
787b5efe02 lib/iscsi: Make iscsi_shutdown_tgt_node_by_name asynchronous
This patch changes spdk_rpc_delete_target_node() to pass
rpc_delete_target_node_done() and its context to
spdk_iscsi_shutdown_tgt_node_by_name().

iscsi_tgt_node_destruct() is not asynchronized yet and so
spdk_iscsi_shutdown_tgt_node_by_name() calls the callback
passed from the caller directly for now.

The next patch will replace the call.

Change-Id: Ide2d9fcc6738e02de19f91249c21ac2d0d37138a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450605
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-04-22 16:00:42 +00:00
Shuhei Matsumoto
e057bb8581 lib/iscsi: Make delete_target_node RPC asynchronous
delete_target_node RPC had not waited for completion of
spdk_iscsi_shutdown_tgt_node_by_name. This implementation
is not the direct cause of the deadlock issue in
spdk_iscsi_conn_stop() but changing delete_target_node RPC
to wait for completion of spdk_iscsi_shutdown_tgt_node_by_name
will prevent future errors.

spdk_iscsi_shutdown_tgt_node_by_name() is not asynchronized yet
and so rpc_delete_target_node calls rpc_delete_target_node_done
directly in this patch.

The next patch will replace the call.

Change-Id: I6a042028b93c36ca9f68e3b212141e101b33d394
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450604
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-22 16:00:42 +00:00
Shuhei Matsumoto
a5478cefbd lib/iscsi: Exit related connections at the start of target node destruction
When any iSCSI target is destructed, if the target exits all corresponding
connections first, destructing SCSI device will be easier.

Hence, iscsi_tgt_node_destruct() starts exiting all corresponding
connections. Then it destructs SCSI device immediately if no active
active connections, or waits for the completion if there is any
active connection for the target.

Change-Id: Ibd4a29789faecfefccefa1153a519c43d040a00d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450737
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-04-22 16:00:42 +00:00
Shuhei Matsumoto
e5108dfaa5 lib/iscsi: Fix the issue that the array of connections is not invalidated
In iscsi_conns_cleanup(), g_conns_array was unmapped but was not
invalidated by setting MAP_FAILED.

So, find_iscsi_connection_by_id() caused segmentation fault if
it is called after iscsi_conns_cleanup().

Change-Id: Ib91c9240c62c2aaa32713dd4aa382d31e5ea2eed
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450901
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-04-22 16:00:42 +00:00
paul luse
766c536184 bdev/compress: add missing mocks and re-enable UT build for comp
Disabled temporarily earlier to get to basic functionality, circling
back now to begin work on UT again.

Change-Id: Ie7606f91072257f392727bdecc5f1eac26380453
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451063
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-04-22 15:44:38 +00:00
Yair Elharrar
2b0ae30bf1 nvmf: fix segfault in case of multi-range unmap
In case of a DSM Deallocate (unmap) with multiple ranges, individual
bdev IOs are submitted for each range. If the bdev IO cannot be
allocated, the request is queued on io_wait_queue; however previously
submitted ranges may complete before memory is available for the next
range. In such a case, the completion callback will free unmap_ctx,
while the request is still queued for memory - causing a segfault
when the request is dequeued. To fix, introduce a new field tracking
the unmap ranges, and make sure the count is nonzero when the request
is queued for memory.

Signed-off-by: Yair Elharrar <yair@excelero.com>
Change-Id: Ifcac018f14af5ca408c7793ca9543c1e2d63b777
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447542
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-22 15:42:51 +00:00
Darek Stojaczyk
e051a5366e vhost: ignore sessions that weren't ever started
The previous patches described as optimizations also
fixed some issues. They seem sufficient to cover all
the error cases, but the real source of the problem
lies in foreach_session() initiated by the device backend,
which can use sessions that were never seen by the
backend.

The backends are only notified when a session is
*started*, but foreach_session() iterates through
all the sessions - even those that were never started.
Vhost SCSI, for example, in the foreach_session() callbacks
used to expect svsession->svdev to be always set, but
that field is only set when the session gets started.

A perfect solution would to introduce a new backend
callback to be called on new connection. Vhost SCSI
could set e.g. svsession->svdev inside. For now we go
with much easier solution that prevents sessions from
being used in foreach-session() unless they were
started at least once. (...and e.g. got their ->svdev set)

Change-Id: Ida30a1f27f99977360d08a71a64fc92931b25b75
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449394
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-22 15:41:51 +00:00
Darek Stojaczyk
bf77d4b774 vhost/scsi: fix newly attached targets being hotremoved by mistake
Before SCSI target is removed, all vhost sessions need
to drain their pending I/O and put their I/O channels.
After a session puts it channel, it sends an async
notification to the entire vhost device. The device
will check if there are any other sessions still
referencing the SCSI target and if not - it will
continue removing the spdk_scsi_dev object. There may
be multiple sessions sending those async events at the
same time, and while we do protect from removing the
same spdk_scsi_dev twice, we can still remove
a different spdk_scsi_dev that was hot-attached in the
meantime with the same target ID.

1. SCSI target hotremove (e.g. via RPC or bdev hotremove)
       /         \
      /           \
session A       session B
drain I/O       drain I/O
    |               |
    v               |
  done              v
send event        done
      \         send event*
       \
All sessions have detached the SCSI target, remove
it from the entire vhost device. From this point
a new target can be hot-attached (e.g. via RPC).

2. Attach a SCSI target with with same target ID.

3. Hotremove event* from the previous SCSI target gets
   finally executed. SCSI target with that ID is
   occupied (again) and may be hotremoved by mistake.

The role of that hotremove event is just to kick the
vhost device and make it remove any scsi targets that
can be removed, so add a check preventing it from
removing devices in states other than REMOVING.

Change-Id: Ia1cc7cae797fd8859d485e63f0ef37aeac2945d0
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449990
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-04-22 15:41:51 +00:00
Darek Stojaczyk
0389c9f9e0 vhost/scsi: don't send hotremove sense codes after session restart
Always unset the VHOST_SCSI_DEV_REMOVED status on
session stop, so that we won't send hotremove SCSI
sense codes after e.g. a VM gets rebooted. The VM
should generally enumerate the SCSI devices again
in such case. We already unset the REMOVED status
for devices which were still attached at the time
of the session stop, but the devices hotremoved
before the session stop retained their REMOVED
status, giving us inconsistent behavior.

Change-Id: I7c5876e29f4bdc99cc060f1d891e24ac57051f37
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449709
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-04-22 15:41:51 +00:00
Darek Stojaczyk
e1c0c4c785 vhost/scsi: fix starting a session while SCSI targets are hotplugged
Vhost sessions currently inherit the SCSI target
status from their vhost devices when started. So
if a session is started while an asynchronous SCSI
target hotplug is in progress, the newly started
session will inherit the VHOST_SCSI_DEV_ADDING
state, which was not meant to be used in sessions
and will likely cause vhost to misbehave. The
ADDING status is used by the entire vhost device
to indicate that some sessions are still hotplugging
the SCSI target and that target can't be hotremoved
just yet. The sessions set their targets' state to
PRESENT when hotplugging them, so newly started
sessions should do the same.

This patch also prevents the same SCSI target to be
hotplugged twice to a single session. It wouldn't
cause any problems, but some resources could've been
leaked.

Change-Id: Icdbff78c167fc1f2f65137087334bd5512e81546
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450052
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-04-22 15:41:51 +00:00
Darek Stojaczyk
2fcc09ec34 vhost/scsi: ignore hotremoved devices in newly started sessions
This an optimization that slightly simplifies the
SCSI target management. Currently if a session is
started while an asynchronous SCSI target hotremove
request is pending, the newly started session will
inherit the target in the REMOVING state. It will be
probably removed from that session in the next
management poller tick, but all that complication
is completely unnecessary. The session shouldn't
have picked up the removed SCSI target when started.
It could have simply checked that the target is
being removed and could have ignored it. That's what
this patch does.

Since the hotremove event used the active session
counter to determine if the removal was additionally
deferred, it had to be refactored to use a separate
per-request context, as there's no longer a direct
relation between started sessions and sessions that
still need to remove the target.

Change-Id: Ib78765290fa337a7d0614e5efc271760e81e4e63
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449393
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-22 15:41:51 +00:00
Jim Harris
4ff7949893 nvmf: remove unused tcp trace point
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8f2e26f46f8c37312c3201df8210b449279640d0

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451476
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-04-22 15:25:37 +00:00
yidong0635
c97e564531 bdev/nvme: fix issue about coredump which caused by assert error.
Here assert(nvme_bdev->id == nsid) ,there's inactive case about nvme_bdev,
 that code will continue. So need to skip the same case in remove_cb.

Change-Id: Idd3bd16d32e75f6d0e448b838676eb6f2ca5cfad
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451445
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-22 15:23:11 +00:00
yidong0635
bb488d2829 isalbuild: fixed make clean issue.
Symbol-link about isa-l, usually rm -f is enough, but some case it changed. And report errors:
Clean up report error:
rm: cannot remove 'spdk/isa-l/isa-l': Is a directory.
or
rm: cannot remove '/home/vagrant/master/build-20190415032826/spdk/isa-l/isa-l': Is a directory
make[1]: *** [Makefile:53: clean] Error 1
make: *** [/home/vagrant/master/build-20190415032826/spdk/mk/spdk.subdirs.mk:44: isalbuild] Error 2

Change-Id: I7f64e2e9708392c8821e2699fdae26223f472689
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448967
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-19 20:19:45 +00:00
Liang Yan
2210eaa9ca examples/nvme/perf: use MiB/s to show bandwidth data
The perf tool's bandwidth data is MiB/s, not MB/s.
So update the data description part.

Change-Id: I770cc0d7c0f0a4d56cb4eff593e88fbed55e3ed6
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451319
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-04-19 20:15:55 +00:00
Seth Howell
7d7b44f2a6 rdma: decrement descriptor before checking SEND_WITH_INVAL
We were incrementing over the end of the descriptor list and assigning
undefined values to the rsp opcode in SEND_WITH_INVAL case. We were only
hitting this error when mixing sgl and inline requests in the same
workload. We were just by chance hitting a four bit value that was set
to all 1s from the in capsule data from the last request.

Change-Id: Ied06356f3d22fa34a2cd869dfad6bdca8720791d
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450873
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-19 17:29:45 +00:00
Seth Howell
3f2553a3f7 nvme_rdma: Allow the SGL to be larger than the req_length
The upper levels of the stack allow for this, so we should follow that
pattern so I/O don't break here.

Change-Id: Ia862f14975a551b0675bafd7709fb7897d0d567e
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450685
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-19 17:29:45 +00:00
Seth Howell
ae694fced8 rdma_ut: add test cases for rdma multi-sgl parsing.
Change-Id: I3ed0b87cdb3496f5096ed5b86e5a8a350064f212
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450306
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-19 17:29:45 +00:00
Seth Howell
2cc6b0dfcb rdma: set the number of wr sge_entries per I/O
This was not being properly set in the multi-sgl path.
Also add a verification step to the fio configuration file to prevent
against future regressions.

Change-Id: I510b6acd92bc2fbc9b6fbec1d59945cc53584ad3
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450305
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-04-19 17:29:45 +00:00