Commit Graph

13812 Commits

Author SHA1 Message Date
yidong0635
d73077b84a lib/jsonrpc: Add a new API to send response for writing bool result.
There are many duplicated codes about sending response for writing bool result.
That we need a function to do this.
Then we can reduce many codes.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: Ic439111b1e9ca1013f8c657ab925f0c27a7be699
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5033
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 15:08:47 +00:00
Shuhei Matsumoto
fd798f8f9e bdev/nvme: Refactor dump_info_json() to clarify querying NVMe driver
Following a previous patch, cache pointers to spdk_nvme_ctrlr and
spdk_nvme_ns in bdev_nvme_dump_info_json().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I769d112f815e29262d52faee5ec17ccb914a7154
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5104
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-11-16 12:26:35 +00:00
Shuhei Matsumoto
b470ed628d bdev/nvme: Get the connected trid from NVMe driver in dump_info_json()
bdev_nvme_failover() updates trid of spdk_nvme_ctrlr using
spdk_nvme_ctrlr_set_trid(). Hence trid of spdk_nvme_ctrlr is always
up-to-date.

Hence bdev_nvme_dump_info_json() can query trid simply by calling
spdk_nvme_ctrlr_get_transport_id(). The queried trid is a const
parameter.  Hence add const to nvme_bdev_dump_trid_json().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id04881f9e7596b910bdf26c4f14f1ebcb3cdbbee
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5103
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-11-16 12:26:35 +00:00
Shuhei Matsumoto
1388d02447 bdev/nvme: Refactor io_type_supported to clarify querying NVMe driver
bdev_nvme_io_type_supported() queries NVMe driver to return if the
specified IO type is supported. To clarify it, cache pointers to
struct spdk_nvme_ctrlr and spdk_nvme_ns.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0956506e720722216e03cb808f61737ada617329
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5102
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
974daa68a6 bdev/nvme: Factor out creating NVMe bdev in nvme_ctrlr_populate_standard_namespace()
In the following patches, nvme_bdev_subsystem will be added and nvme_bdev_ns
will be added to not nvme_bdev but nvme_bdev_subsystem.

To do it easier, factor out creating an NVMe bdev into an new helper
function nvme_bdev_create().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifa902912ba1ea979153b04ef4ac9fae10c09b7e2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5018
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
744414c087 bdev/nvme: Pass nvme_ch to bdev_nvme_reset() to queue I/O easily
bdev_nvme_reset() has been called only by a single caller now.
Hence pass nvme_ch to bdev_nvme_reset() to queue I/O easily.

This will improve readability and clarify the logic.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idc22cb499fcf8455a2b04d44688f999344abc352
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4992
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
a563df3b83 bdev/nvme: Factor out the common opeartion of bdev_nvme_reset()
Factor out the common operation between internal calls and bdev I/O
calls of bdev_nvme_reset() into an new helper function
_bdev_nvme_reset().

This is to improve readability and to clean-up the operation only
for bdev I/O calls in the next patch.

Replace bdev_nvme_reset() by _bdev_nvme_reset() for internal calls.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7580a8fb40d5a1d694d5f913cde770ca95a0b0c8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4991
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
b14c7cd8f2 bdev/nvme: Rename _bdev_nvme_reset to _bdev_nvme_reset_ctrlr
_bdev_nvme_reset_ctrlr will figure out what it really does.
_bdev_nvme_reset will be used by an new helper function in the
next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I890f962529a663ea412bcd416ef9ba31fadfbf61
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4990
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
460bd99a28 bdev/nvme: Consolidate error paths of _bdev_nvme_reset_create_qpairs_done()
Clarify the operation done in the error paths for readability.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Icb8a1a7c569e88d474737d0449c8eef73759a633
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4989
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
4e8f5d39ec bdev/nvme: Fix bdev_nvme_delete() to call ctrlr_get_by_name() and set destruct to true in a lock
bdev_nvme_delete() had called nvme_bdev_ctrlr_get_by_name() and
then called remove_cb(). But nvme_bdev_ctrlr_get_by_name() had not
been guarded by lock and remove_cb() parsed the list again by using
spdk_nvme_ctrlr as a key.

These were not safe and efficient.

This patch refines bdev_nvme_delete() to inline remove_cb() into
it and acquire mutex before calling nvme_bdev_ctrlr_get_by_name().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibf39859809efa6f22899353c53b7b1eef58aa470
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4842
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
edbb7ace72 bdev/nvme: Include path removal into bdev_nvme_failover()
Add the second parameter remove and include path removal into
bdev_nvme_failover(). Additionally, bdev_nvme_failover() returns
only two return values, 0 or -EAGAIN, and hence change
bdev_nvme_remove_trid() to return the return value of
bdev_nvme_failover() directly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ife560f886e32ecec23691e01e87069502e27cc0c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4867
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
b0100cef46 bdev/nvme: Extract failover case from bdev_nvme_reset() into bdev_nvme_failover()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib0517ed5bcf9ee5741f7a4d7106e2bc0ba7c36cc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4866
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
f1fb19e332 bdev/nvme: Fix the race condition between destruct and reset controller
nvme_bdev_ctrlr_destruct() had checked first if poller is already
registered. On the other hand, nvme_bdev_ctrlr_destruct() had been
used as a poller function.

Hence nvme_bdev_ctrlr_destruct() had no way to unregister poller
if destruct and reset controller were raced.

This patch fixes the issue. The previous patch ensures nvme_bdev_ctrlr_destruct()
is called only once.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iba5424c42a4a3e5f03575df2616ec2a817e38f51
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4827
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
0939c07505 ut/bdev_ocssd: Clean up controller destruction
Previously local boolean variable empty was used to destruct a
controller in delete_nvme_bdev_controller(). However, it was hard
to understand and did not work well with refactoring.

Using reference count is more sophisticated and works well, and hence
done in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I59d0552c16653495fa55e9bfe4a2c0a316a204c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4355
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
01f769c62a bdev/nvme: Ensure ctrlr->destruct is set only once
Checking if destruct is false and setting destruct to true are
separated by mutex in remove_cb() and bdev_nvme_library_fini().

It was possible that multiple threads called nvme_bdev_ctrlr_destruct()
because the caller could call nvme_bdev_ctrlr_destruct() before
setting destruct to true after knowing it was false.

This patch ensures that nvme_bdev_ctrlr_destruct() is called only once.

Set ctrlr->destruct to true without releasing mutex after checking
if ctrlr->destruct is false.

If destruct is set to true before calling nvme_ctrlr_depopulate_namespaces(),
nvme_ctrlr_depopulate_namespace_done() may call nvme_bdev_ctrlr_destruct()
because it is likely that reference count is zero and destruct is true.
In this case, remove_cb() or bdev_nvme_library_fini() cannot call
nvme_bdev_destruct() after returning from nvme_ctrlr_depopulate_namespaces().

On the other hand, if a controller has no namespace,
nvme_ctrlr_depopulate_namespaces() does nothing and
nvme_ctrlr_depopulate_namespace_done() is not called. Hence
remove_cb() or bdev_nvme_library_fini() has to call nvme_bdev_destruct()
after returning nvme_ctrlr_depopulate_namespaces().

To unify both cases, initialize reference count to one as a sentinel value
and remove_cb() and bdev_nvme_library_fini() decrement reference count
and then calls nvme_bdev_ctrlr_destruct() if reference count is zero
after returning from nvme_ctrlr_depopulate_namespaces().

Additionally, add assert to check if reference count is not negative
to find bug in future.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8a617b5aa4d0a9faff832e63c2ed4b353341dd6b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4817
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
844e6bfa8c bdev/nvme: Add subnqn of controller to bdev_nvme_dump_info_json()
subnqn will be used to manage subsystem, and so add it to the output
of bdev_nvme_dump_info_json().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id28023754fa19d14aa9297f4e6676d235f024e0f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4974
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
93a91be642 bdev/nvme: Factor out common operation of create_cb() and reset_create_qpair()
To improve readability and make the following patches easier,
factor out the common operation of bdev_nvme_create_cb() and
_bdev_nvme_reset_create_qpair() into bdev_nvme_create_qpair(),
and factor out the main operation of bdev_nvme_destroy_cb()
into bdev_nvme_destroy_qpair(). bdev_nvme_destroy_qpair() is used
in the error path of bdev_nvme_create_qpair().

Updating g_opts.io_queue_requests again is no harm and so is done
in bdev_nvme_create_qpair().

Use the term nvme_ch in bdev_nvme_create_cb() and bdev_nvme_destroy_cb()
for clarification.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie0a4251023037958d122fbb5d7ee72d42238b3ed
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4981
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-11-16 12:23:04 +00:00
Shuhei Matsumoto
0768aa10e3 bdev/nvme: Rename ch by nvme_ch of create_cb() and destroy_cb()
This change will make the next patch smaller and its review easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2784fa74dce98676958180bbf80a9a4f938454db
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5101
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-11-16 12:23:04 +00:00
Jiewei Ke
012bd3b942 lib/nvmf: Notify ANA change when namespace change happens
When ANA is enabled, if a new namespace is hot-added to the subsystem on
the target side, the Linux host will expect to receive an ANA change
notification after the namespace change one. Without the knowledge of
the namespace's ANA state, the host will not register the associated
block device, so users cannot see the nvme device.

In this patch, ANA change is notified right after namespace change, so
host will get ANA log, update the namespace's ANA state and then
register the block device if it is alive.

Signed-off-by: Jiewei Ke <jiewei@smartx.com>
Change-Id: I2faf61d344eb6de7efb2fde3cb1013cf0efd3c2e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5097
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-11-16 12:22:50 +00:00
Liu Xiaodong
b7f7bbd16b sock/uring: reap if some sock has data in pipe
Since spdk_sock_group_poll should do level trigger to
the callback func registered in spdk_sock_group_add_sock,
if there is data in pipe, but not event occurs, poll func
should still reap sock who has data in pipe.

Change-Id: If3a983f80fd04708e45ad0398c7d34018ec52bc7
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5072
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-11-16 12:22:43 +00:00
Karol Latecki
cc5ade1bfc autobuild.sh: print git log when builiding external dpdk
Having a brief gitlog of build external DPDK makes it
easier to track what has changed in case of failures
detected in CI.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I549405b017c38bb5706d64a00022a2521d950a3e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4932
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-11-16 12:22:31 +00:00
Jim Harris
a2be549268 CHANGELOG: fix path of default JSON-RPC domain socket
The original entry was wrong - the path has always been
/var/tmp/spdk.sock.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I24febd74c5eac31b1c56f2e053636660a641fbc0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5087
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-11-13 15:00:45 +00:00
Anil Veerabhadrappa
65b5866e0e nvmf/fc: optimize code to access structure members only when needed
Reference the struct members only when it is necessary.

Signed-off-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Change-Id: I44208dfde20f74ab96e494445a464bf45f7ab408
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5070
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-11-13 14:11:50 +00:00
sunshihao520
33e1f4b0e2 lib/thread: return NULL when id is invalid before search form tailq
When call spdk_thread_get_by_id function to use thread->id to get thread point, if the id value is invaild, just return NULL before search from g_threads tailq.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: Ic6c35d2c2b5093c9b513618742b8b9835599ba63
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5031
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-11-13 14:10:37 +00:00
Ziye Yang
57833a5dff iscsi: fix the warning issue in tgt_node.c reported by vagrant.
The allocated size of buf is too large,i.e., 4096. And we will
have host to be assigned with buf, host = buf. But the tmp_buf (destination)
buffer is not so big. So restrict the buf size and make the vagrant happy.

The max size of conn->target_addr is MAX_TARGET_ADDR, so add additional 2 is enough
according the format to print.

The warning is:

/home/vagrant/spdk_repo/spdk/lib/iscsi/tgt_node.c:377:47: warning: ‘%s’ directive output may be
truncated writing up to 4095 bytes into a region of size 301 [-Wformat-truncation=]
00:03:02.381    377 |     snprintf(tmp_buf, len + 1, "TargetAddress=%s:%s,%d", host, p->port, pg->tag);

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ib64e7140d5e14909d2a86dd2d47413abe5cd027e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5092
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-11-13 14:05:05 +00:00
Naresh Gottumukkala
7b0f650cff nvmf/fc: Remove dead code in FC transport.
Remove linkbreak related code that is not being used anywhere.

Signed-off-by: Naresh Gottumukkala <raju.gottumukkala@broadcom.com>
Change-Id: I8ab2a8337fd5615bdb75744a7abcd28ec3d41f2b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4977
Community-CI: Broadcom CI
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-13 05:29:56 +00:00
Jim Harris
39c31e6c0c test/external_code: make clean before starting tests
This test script is based around only a strict
subset of the SPDK configuration options.  If we don't
clean before building, we could still have libraries
in build/lib from previous tests that the external_code
Makefiles do not account for when linking libspdk.so,
which will include *all* libraries in build/lib.

Fixes issue #1662.
Fixes issue #1665.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I525ea1740313048fc44f26b5b0db9ab38161725e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4970
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2020-11-13 05:29:38 +00:00
Jim Harris
1b56233c0c build: add SPDK_NO_LIB_DEPS to build libraries w/o dependencies
Our check_so_deps.sh test script removes the spdk.lib_deps.mk
include from spdk.lib.mk so that we can check which symbols
the libraries depend on.  But modifying the code like this
is a bit kludgy.  So instead add a Makefile variable that
check_so_deps.sh can set to get the same behavior.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I5622f4c3adb2d5ccd5ae33cb4cd116716134a9b7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4512
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2020-11-13 05:29:38 +00:00
sunshihao520
bf13dc4801 bdev/rpc: use goto to make code reuse.
delte duplicate code and use goto to make code reuse.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: Ib5eae0d31699fa7e3a0e6147b1572d383208df0b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5052
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-11-11 01:02:31 +00:00
sunshihao520
d2a0706982 lib/conf: check pointer return value when use calloc
add return value check when use calloc to create spdk_conf_section struct.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Signed-off-by: linfeilong <linfeilong@huawei.com>
Signed-off-by: liuzhqiang <liuzhiqiang26@huawei.com>
Signed-off-by: suweifeng <suweifeng1@huawei.com>
Change-Id: Iab89491b7c6942337fa7b1ab765e7bb509c1e92b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5051
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-11-11 01:02:31 +00:00
sunshihao520
be979ad11e app/spdk_top: check NULL pointer after use newwin or new_panel
When use newwin or new_panel function, the return value maybe NULL. Check the return value before use it will be more safe.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Signed-off-by: linfeilong <linfeilong@huawei.com>
Signed-off-by: liuzhqiang <liuzhiqiang26@huawei.com>
Signed-off-by: suweifeng <suweifeng1@huawei.com>
Change-Id: Ifef8ed91b778cc4577cec1834f6596c58643e5c4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5050
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-11 01:02:31 +00:00
Maciej Wawryk
1d03a9baf4 scripts/vagrant: Remove unused vhost stuff
We don't use this script to create qcow2 images for our tests in CI.
Also this script is using random vagrant box images, and we don't know
what is inside them.
Script maintenance is a tedious affair because fedora boxes use xfs file
system, and we can not shrink them virtual disk to minimal size, and this
will caused fails in tests in future.

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I7b35f16bbfd6135377995f7b20e1402d14b2b1b1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4738
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-11-11 00:55:33 +00:00
Jin Yu
30f9feca2a test: add md_buf unit test in splitting test
Change-Id: I83010cdc7af49a29e516bcd351d67154307756ad
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4884
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-11-11 00:55:08 +00:00
Madhu Adav MJ
fce9428772 nvmf: Async event support for discovery log change
Added asynchronous event notices for discovery log change
as per nvme fabrics spec 1.1. This allows a host with persistent
connection to discovery controller to automatically connect to any
new subsystem available to the host automatically.

According to nvme fabrics spec 1.1, if the connect command specifies a
non-zero keep alive timer value and the discovery controller does not
support asynchronous events then we need to return Connect Invalid.
Since SPDK does not implement this check instead added support
for asynchronous events in discovery controller.

Change-Id: I4cade5f7d24826ce97a2fa2b4ca688a1d728c1db
Signed-off-by: Madhu Adav MJ <madhu.adav@flipkart.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4870
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
2020-11-11 00:53:57 +00:00
Ziye Yang
abb6823d5d iscsi: Add the support for long text response.
This patch adds the support for long text response.

Change-Id: I8ef146069c9b8d86eb6df4c9e60cc6a3b2ff1ad7
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4993
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
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>
2020-11-11 00:53:52 +00:00
Jim Harris
0e47be4b41 nvme: add nqn prefix to hostnqn
Section 7.9 of the NVMe spec says that all nqns must
start with "nqn.".

Fixes issue #1669.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7fd0e6a0a397e831c4fa2377126b6b1e1b127d88
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5017
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-06 08:11:54 +00:00
Shuhei Matsumoto
db853f0510 bdev/nvme: Consolidate nvme_ctrlr_populate_namespace_done() calls
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1190740d949eba78e1b9f8915a5b044d0cec1d9e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4919
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-11-06 08:11:50 +00:00
Shuhei Matsumoto
4a9d0af5a8 bdev/nvme: Register nvme_bdev_ctrlr to the argument of the timeout callback
This change removes the necessity to get nvme_bdev_ctrlr by calling
nvme_bdev_ctrlr_get_by_name() and simplifies the code.

bdev_nvme_reset() checks if nvme_bdev_ctrlr->destruct is false first.

Hence we will not degrade stability.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7a3baab666644c3063af404905284c3e16bc62ab
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4843
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-11-06 08:11:50 +00:00
Rafal Stefanowski
ebd8ef4bc5 bdev/ocf: Fix metadata updater call
OCF metadata updater is handling all the requests at once and when
it finishes the cache can deinitialize, so in the rare circumstances
when the thread is not aware of cache not existing any more, there
is another metadata kick request and check for the random pointer
is performed instead of expected cache.
The solution is to increase/decrease cache ref count prior sending
a message to a thread and after metadata has been updated.

Fixes #1533

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Change-Id: I77d2ae400110fcb4d491350e5fec334245f4bb90
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5030
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-11-06 08:11:19 +00:00
Liu Xiaodong
b3a8025d1e hello_sock: print new line after print usage
Change-Id: I25b82d80b5f622c346df0577eac274b4b50a30a1
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4883
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-06 08:11:12 +00:00
sunshihao520
4237d2d8cb lib/thead: print error log when create mempool or ring failed
Add debug information when call spdk_mempool_create or spdk_ring_create to create resource for spdk failed.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Signed-off-by: suweifeng <suweifeng1@huawei.com>
Change-Id: I0bd99ba473c8cb6f68045e3009db50cf2e392dd3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5019
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-11-05 09:41:06 +00:00
sunshihao520
686401ebf2 lib/thead: add information when poller isn't free
When call _free_thread in the exit process, print poller type information to identify which type poller is not free.
Even if the fuction spdk_poller_register_named called, we don't konw what type the poller is.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Signed-off-by: suweifeng <suweifeng1@huawei.com>
Change-Id: I43f8d51b08a01169d418e6a6a46266887f9a85dd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4999
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>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-11-05 09:41:06 +00:00
Ben Walker
7dbe9cfa0f bdev/nvme: When detecing multipath, only compare active namespaces
Calling spdk_nvme_ns_get_data(ns) on an inactive namespace will crash.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ib8cfa84e785a4a04dc3b1826c700a22eeec51e3c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5013
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>
2020-11-05 09:40:33 +00:00
Jim Harris
e7cbcec38e app_ut: add stubs required w/ clang build
clang-9 is a bit more onerous on stubs required in
the unit test file.  app_ut specifically needs
spdk_reactors_init and spdk_reactors_fini added.

Fixes issue #1613.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaa219829e933405ddb662f5b991204ef05b3bd75
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5016
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-11-05 09:38:48 +00:00
jiaqizho
384be89f7f nvmf : fix custom trtype no right in nvmf_tgt_write_config_json
When user used CUSTOM transport, follow this step can reproduce:
1. run ./nvmf_tgt
2. ./rpc.py nvmf_create_transport -t ABC (ABC is the transport name)
3. ./rpc.py save_config >> config.json

Then in config.json :
{
	"subsystem": "nvmf",
	...
	"config": [
	{
          "method": "nvmf_create_transport",
          "params": {
            "trtype": "CUSTOM",
	    ...
	  }
	]
}

trtype should be ABC , because nvmf_create_transport need pass
the transport name to create transport.

Signed-off-by: jiaqizho <jiaqi.zhou@intel.com>
Change-Id: Iaf24837b649a1736568902f898d48135dac0882d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4973
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-11-05 09:38:27 +00:00
Jin Yu
1b5a65a73d bdev: fix md_buf split issue
For each child IO, when md is separate.
data_buf_addr = parent_data_base + offset * data_block_size;
md_buf_addr = parent_md_base + offset * md_size;

Change-Id: I92f9a04baa4d90ba55338591007b148e2bae545c
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4844
Community-CI: Mellanox Build Bot
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-11-05 09:38:11 +00:00
Tomasz Zawadzki
ae2a100fc8 test/ocf: remove unused nvme_cfg() function
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I8f002721e0245fcc4c206084d48b84917c164924
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4803
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>
2020-11-05 09:37:55 +00:00
Michal Berger
ed3cd2b927 pkgdep/git: [qemu] Ignore address-of-packed-member errors
Also, disable docs building since it fails on newer GCCs (>=10).
Last but not least, move all the -Wno-error flags to a separate
array to make code a bit clearer.

Change-Id: Ieb6d30778140c745a8c9f0ccd83bf4acd3a0acd5
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5004
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-04 16:42:45 +00:00
Michal Berger
dbd140b20b test/common: Check NASM version from within get_config_params()
This is done to avoid conflicting parameters being passed to
./configure via get_config_params(). Originally, if all previous
conditions were met, get_config_params() would return "--with-reduce"
in the string. ./configure would lookup the NASM version on its own
and disable the --with-reduce and --with-isal parameters. However,
--with-reduce would be set again by ./configure while looking up
the cmdline. This would end up with --with-reduce and --without-isal
being set together, failing the configuration.

Change-Id: I81fa1dfd4bc5b41b82525e911b1c75fc7e15fd14
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5003
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-04 16:42:45 +00:00
Michal Berger
86eadb4d7c scripts/common: Change name of the cmp() function
It could potentially  override cmp binary, causing failures in some
of the tests.

Change-Id: Ia0bd88222c60e5b8a13d3809a6213b457b887b41
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5005
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-04 15:27:28 +00:00