Commit Graph

1249 Commits

Author SHA1 Message Date
Dariusz Stojaczyk
3907139e34 iscsi: fixed crash on invalid add_portal_group call
Fixed double free in spdk_rpc_add_portal_group()
spdk_iscsi_portal_create() now takes string arguments as const char* and makes internal copies of them.
This patch also fixes potential memory leak when id == NULL

Change-Id: I4d0efb101471fb2368ceb8ceecb0e40614e3585d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-03-27 15:19:38 -07:00
Ben Walker
abc73f6995 blob: Handle failure to alloc xattr on parse
Or rather, at least assert that the allocation failed.
This is not a recoverable error in general.

Change-Id: I9bc325066e829fc311ce84ce83536e9933ac5473
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-27 15:15:24 -07:00
Ziye Yang
66aabffcae blob: free the blob in error case
Change-Id: I645e01123949fc4707509d0626f8a5327b7bdd3c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-27 14:38:25 -07:00
Ben Walker
d827cfbde6 blob: Handle allocation failures in set xattr
Change-Id: Ida9361066e8b3117d1022379d75e290b11f86b52
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-27 13:54:54 -07:00
Cunyin Chang
01922c74d1 bdev/nvme: Make sure the bdev/nvme increment by 1 for new inserted device.
Change-Id: I691bb567c9fbfdb7e41f5602fe58645f232a0ee8
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-27 13:26:38 -07:00
Ziye Yang
ef91841763 (i)scsi: check strlen before copy
Make sure that we have space for termination char '\0'

Change-Id: Iaebdad3b4278ee322bd78247acc7f0997c3f4b44
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-27 11:37:15 -07:00
Ziye Yang
2abea9da4e lib, vhost: check the numbers of reqs
Change-Id: I567b9a330aa284f08dd16993686200dd1dd7990f
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-27 10:45:56 -07:00
Ziye Yang
e439020961 vhost: check the strlen of basename
Change-Id: I0f0eb7edbec71609754a4cda80c578b75c84c87f
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-27 10:26:43 -07:00
Changpeng Liu
fa9d3466aa scsi/bdev: assert on failed data buffer malloc
Change-Id: I4f698d7c35e3315c86a6dc15b930c349ba6b105f
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2017-03-27 10:08:12 -07:00
Daniel Verkamp
c3f109f91e trace: Increase the size of trace name
According to the analysis, the largest name size is
24 not including '\0' (NVMF_RDMA_WRITE_COMPLETE),
so change the the size of name. Also add a check
to avoid the str exceeding our defined name size.

Change-Id: Iddf2cb52a3f5358306a59fc66bb997fa8098cde0
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-27 09:50:09 -07:00
Jim Harris
38f91be52b blobfs: cache_insert_buffer() - check count before allocating buffer
This avoids corner case where a buffer gets allocated on the 100th
try.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If65053d539d458d9a53c8850bbb4cbe4ee84f604
2017-03-24 16:06:37 -07:00
Jim Harris
7079a18f21 blobfs: add assert in fs_open_blob_create_cb to satisfy static checker
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia67d8a42825f7287c48729ec4d88d94a9efe430e
2017-03-24 16:06:37 -07:00
Jim Harris
f2e4d641a5 blobfs: fix use after free in init failure path
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7709c08abc103023363bede99e06bf07984c04ca
2017-03-24 16:06:37 -07:00
Cunyin Chang
e5b62c126a bdev/nvme: assign names to hot-inserted devices.
this patch fix the potential possibility of coredump when
we have NVMe device hot inserted.

Change-Id: Idac255f25f42b4746c2d3ae6dfc57a19b7001160
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-24 15:50:40 -07:00
Jim Harris
1edd9bf3e4 blobfs: Add a lightweight filesystem built on the blobstore
This is the initial commit for "blobfs", a lightweight
filesystem built on top of the SPDK blobstore.

Also included in this patch:

1) a shim for using SPDK bdevs as the backing store for
   SPDK blobstore/blobfs
2) documentation for using blobfs as the storage engine
   with RocksDB
3) scripts for running a set of workloads and collecting
   profiling data with RocksDB and blobfs

See doc/blobfs/getting_started.md included in this commit
for more details on blobfs, including some of the current
limitations.


Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2a6d3d4b87236730051228ed62c0c04e04c42c73
2017-03-24 14:15:45 -07:00
Ziye Yang
dc1a2f814e bdev,nvme: check the return value of spdk_nvme_ctrlr_get_ns
Change-Id: Icae49d87562b07e80099622681cdf83fa6930b30
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-24 12:18:51 -07:00
Daniel Verkamp
0d752e42f8 scsi: ensure LUN name is null terminated
Change-Id: I2c0d0d9dd4f4b852401f21b65142ee85c29f3c62
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-24 10:52:48 -07:00
Daniel Verkamp
2b0b705fb1 reactor: make sure socket_count isn't zero
Avoid division by zero in the event mempool cache size calculation.

Change-Id: Ic117ef2dc3a798fb0a57572f1178233e83e73849
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-24 10:52:28 -07:00
Ziye Yang
31b81b0dd6 bdev, split: check the memory allocaton of spilt_base
Change-Id: I4cc3d6e5397143b0b98d4a222c01a76128093191
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-24 10:52:05 -07:00
Cunyin Chang
b6671531ad event: Verify log_facility is not NULL before using it.
Change-Id: Ia20d8764c2c91c200d06b7017ed06060e40cc2ed
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-24 12:33:00 +08:00
Ziye Yang
fea78497a1 lib/vhost: Handle realloc failure
Change-Id: I47157e33e306205fa261e65e4b99fa13c1f1148d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-23 16:04:27 -07:00
Cunyin Chang
1bbb43c544 nvme: Replace some strcpy with snprintf
Change-Id: If80ae64fa672ae6b847ad985be6862e5d2b3729b
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-23 15:26:07 -07:00
Dariusz Stojaczyk
0e2ea8797f bdev/nvme: remove dangling pointer from g_nvme_bdevs list on bdev_nvme destruction
It was causing segfaults and infinite looping.

Change-Id: I4c19b5d3af1ba1360250cd5f6aa573a27003409f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-03-23 14:40:35 -07:00
Cunyin Chang
118c08154e lib/env_dpdk: exit if allocating dpdk_args fails
Change-Id: Ib7268d679ed73e73b5bc20f08dc381315ee4fd9d
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-23 14:33:10 -07:00
Daniel Verkamp
6e2d7be8a1 vhost: add copy of virtio headers
This enables the vhost library to build on systems missing the (fairly
recent) linux/virtio_scsi.h header.

Change-Id: I680863b26961ec3cbe4ad4e575555454f6461bbf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-23 13:51:04 -07:00
Ziye Yang
74da2fade4 Replace sprintf with snprintf in several files
Change-Id: I2a46433e81e605e57df4b2a1a9c1c27097333d0c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-23 13:33:21 -07:00
Ziye Yang
228a81f1bc lib/net: Replace sprintf with snprintf
Change-Id: I86999b8f8ad4363e163c7e3f8d46dd49fb7c848c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-23 13:30:09 -07:00
Ziye Yang
0c0582d3ce event: Verify lcore is valid when registering poller
If we do not do a bounds check, this can run off the end
of an array.

Change-Id: I43cc4848fca7d68218e507db20e33823f8b550e4
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-23 13:30:04 -07:00
Daniel Verkamp
4b887a8cbc nvmf: start even if no transports are available
Attempting to add a listen address for an unavailable transport will
fail with a better error message.

Change-Id: If4cf5b66c16dadcb6e0f0b28cea4aa510ba6a9fc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-23 13:17:52 -07:00
Daniel Verkamp
7035c39136 nvmf: print error if transport name isn't found
Rather than failing silently, let the user know why the listen address
failed.

Change-Id: I41c2a51c6071ee739b282a1a39198a2887a73c4d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-23 13:17:52 -07:00
Daniel Verkamp
2563429809 nvme: convert uevent failure message to TRACELOG
The message about the uevent socket is not a fatal error; it just means
that hotplug monitoring will not work.

Change-Id: I29f6a253e96a86420c0fde9e19135f9f1d229bb9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-21 15:39:21 -07:00
Ben Walker
d89352a95c blob: Add a persistent, power-fail safe block allocator
This is the initial commit for the "blobstore", a lightweight,
highly parallel, persistent, power-fail safe block allocator.

Documentation will be added in future patches.

Change-Id: I20a4daf899f1215d396f7931c3ec9a2e2bb269d0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-21 14:21:21 -07:00
Jim Harris
e2b330e989 nvme: correctly handle valid PRPs with non-block size first/last elements
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I801547126987b1a2c5e8e95d468c30e508a1c3b0
2017-03-21 08:03:29 -07:00
Ben Walker
6d7b6e882c bdev/aio: The user now provides the names of AIO bdevs
The user now must choose the name for each AIO bdev. This
provides consistency for names across restarts.

Change-Id: I13ced1d02bb28c51d314512d60f739499b0c7d8d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-20 15:18:03 -07:00
Seth Howell
39ad6c3151 bdev/nvme: Fix null terminator checks in trid
The fields are char arrays, not pointers.

Change-Id: Ieb21e7a70853ed582e459d167a66b1aa5b8c93d3
Signed-off-by: Seth Howell <seth.howell@intel.com>
2017-03-20 14:13:10 -07:00
Daniel Verkamp
790bad22c3 nvmf: add discovery controller ops
Simplify code that previously needed to check for subsystem type by
factoring out the discovery controller operations into a new ops
instance.

Change-Id: Id87b498e4623451993fe779ffb765be5a6743fd9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-17 15:55:36 -07:00
Daniel Verkamp
d535f9b7bb nvmf: split discovery service into its own file
No functional change, just rearranging code.

Change-Id: I28328dfefd7de269d326834c484f2c2fca4e6c1f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-17 15:55:36 -07:00
Ben Walker
1f38243914 nvmf/rdma: Combine RDMA WRITE and SEND into single post
When data needs to be transferred from the controller
to the host, do a single ibv_post_send containing
both the data and the completion.

Change-Id: I072c545b31593e0e324c97ed700b42c6a4c358e1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Ben Walker
6696fce7ae nvmf/rdma: Manually inline nvmf_post_rdma_send
This call had been reduced to a simple wrapper
around the ibv call. Delete it.

Change-Id: I42926d123db262617119a9cff77bc0d0eb1e8f31
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Ben Walker
7488116a78 nvmf/rdma: Manually inline nvmf_rdma_post_[read|write]
These functions were only called from one place and
their functionality has been reduced to a wrapper
around the underlying ibv call. Remove them.

Change-Id: I65182012dbe6393b9d57f4191fd327bcd025a6c8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Ben Walker
a4a3b5e7fd nvmf/rdma: Move all SGL setup to the prep_data step
This keeps all SGL handling in the prep_data function.

Change-Id: I9bfeed3748c1b329288350b85aa87bd604cfce4e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Ben Walker
e0bdfb14ee nvmf/rdma: Manually inline nvmf_rdma_post_recv
Now that all of the SGL mappings are static,
this function just called ibv_post_recv. Delete
the function and call ibv_post_recv directly.

Change-Id: I45216170a157709249b08c4cb0ebdb1adb906049
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Dariusz Stojaczyk
b276649c98 vhost: check if file is a socket when creating a controller
This patch makes create_vhost_scsi_controller check if given file is a socket before deleting it

Change-Id: I7a37c12913b461f779732e724c85e2f7b5d67442
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-03-17 08:59:02 -07:00
Ben Walker
cc294653ca nvmf/rdma: Send data and completion at the same time
For an NVMe read, send the completion immediately
following the RDMA WRITE, without waiting for
the acknowledgement. RDMA is strictly ordered,
so the WRITE will arrive before the completion.

Change-Id: I7e4e01d7a02c2130b655ef90f5fdaec992d9361a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-16 16:44:45 -07:00
Ben Walker
d0fb728ad2 nvmf/rdma: Don't use in-capsule buffers for READ/WRITE
Except for a CONNECT capsule, always use the central data
pool for RDMA READ/WRITE operations. The in-capsule
data buffer is associated with the receive operation
while the pool data buffers are associated with the
completion, and using the in-capsule data buffer
causes a lifetime mismatch.

Change-Id: Ieb45e521d78daa7c706078a3dd5c5a146f8dc1d6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-16 16:44:45 -07:00
Ben Walker
23f273c0b1 nvmf/rdma: Revert 8fefa7e
After commit b654e9b, this is no longer required.

Change-Id: I0cf1a7059d7fba0303aca5ad5a15afe3890b4172
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-16 16:44:45 -07:00
Ben Walker
1db3a03712 nvmf/rdma: Do not assume acks are ordered.
The RDMA protocol this module uses is strictly ordered,
which means messages are delivered in exactly the order
they are sent. However, we have detected a number of
cases where the acknowledgements for those messages
arrive out of order. This patch attempts to handle
that case.

Separate the data required to post a recv from the
data required to send a response. If a recv arrives
when no response object is available, queue the
recv.

Change-Id: I2d6f2f8636b820d0c746505e5a5e3d3442ce5ba4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-16 16:44:45 -07:00
Ben Walker
d326998ce7 bdev/nvme: Names are now explicitly assigned by the user
Names for the NVMe bdevs are now assigned by the user.
This means the same name will always be assigned to the
same device, even across restarts.

Change-Id: If9825ec9abcb5236b4671bc44a825e4f0d704fe3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-15 17:42:45 -07:00
Cunyin Chang
b7349216b9 nvme: optimization for nvme probe and detachment.
remove the unnecessary rte_eal_pci_probe_one() in function
spdk_pci_device_detach(), this could cause error message when we
terminate the application, it will also not make sense try to probe one
device after we detach it, we could call spdk_pci_nvme_device_attach()
instead of spdk_pci_nvme_enumerate() when we have one given device address,
dpdk will try to scan the device and add it back to pci device list then.

Change-Id: I35f5bb412249bb20da57394f0531c10a49691906
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-15 09:00:25 -07:00
GangCao
f75fe7394a nvmf: add an outstanding admin IO tracker in direct mode
Change-Id: I06e0de6dc28115f0cb53151d67138f9271093687
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-15 08:02:39 -07:00