Commit Graph

24 Commits

Author SHA1 Message Date
Shuhei Matsumoto
f7b7195aa0 lib/iscsi: Replace the "spdk_" prefix by "iscsi_" for internal APIs declared in iscsi.h
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1e5a8b567e87ab5693402d164bf73fe22afa45af
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1891
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-04-20 07:38:29 +00:00
Shuhei Matsumoto
356cb2332c lib/iscsi: Remove the "spdk_" prefix from internal APIs declared in task.h
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I746660725f013df93b56ea89d11783ee5c568609
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1884
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
2020-04-20 07:38:29 +00:00
Shuhei Matsumoto
9ccf32d64e lib/iscsi: Fix double free of primary task when write I/O is split
When a iSCSI write is large and split, if LUN is removed between
creating and submitting the last subtask, spdk_clear_all_transfer_task()
completes the primary task and then process_non_read_task_completion()
tries to complete the primary task.

This is the double free case, and the later have to be skipped.

We add a flag is_r2t_active to struct spdk_iscsi_task and use it to
check the duplication. We may be able to use primary's initiator task tag
(ITT) instead but we can not rely on ITT because it is set by the initiator.

We clear is_r2t_active even when primary is removed from
conn->queued_r2t_tasks but it will be no harm.

Fixes the issue #1064.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia6511bd7adaa8fcb9a07bc40d498e8ee0b7a7ccf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475044
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-12-05 12:21:09 +00:00
Shuhei Matsumoto
6bf57c7fd1 lib/iscsi: Remove unused spdk_iscsi_task_get_cmdsn()
This is not used anywhere now.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If65321abcd3601af91725c2117cdce10dd0ffc63
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474176
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-11-19 09:10:14 +00:00
Seth Howell
72d06a99e1 Revert "iscsi: change the field bhs to pointer type."
This reverts commit 80cf038ced.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I95e2ddfbc9cd07e874a385b345dc401fc8076e88
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468778
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-09-19 05:04:00 +00:00
Ziye Yang
80cf038ced iscsi: change the field bhs to pointer type.
Purpose: Prepare for the further optimization work
to use one bigger buffer to read more data for
reducing system calls.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ie92603b09308bd3149263269fdec355b67251b37
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468538
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: Ben Walker <benjamin.walker@intel.com>
2019-09-18 18:14:53 +00:00
Shuhei Matsumoto
37af0cc930 iscsi: Propagate SCSI error status to split SCSI read/write commands
For split SCSI read command, if there is any failure in the sequence of
it, the first error must be propagated to all subtasks of it.

For split SCSI write command, if there is any failure in the sequence
of it, the first error must be propagated to the primary subtask.

Before this patch,
for read task:
- any failure is propagated to already completed subtasks, but
  is not propagated to any subtasks not completed yet, and
- if any failure occurs in non-primary subtasks, it is not propagated
  to the primary subtask.

for write task:
- if the primary subtask completes after any failure of non-primary
  subtasks, the failure will be overwritten by the success of the
  primary task.

This patch fixes these issues.

Change-Id: I2d878798cbb40a8c5bd6a6fe5efb32b8de4a8ecd
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/436673
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-12-11 16:37:55 +00:00
Shuhei Matsumoto
5124f87f4e iscsi: Abort queued datain task before submitting abort to SCSI layer
By up to the previous patch in the patch series, unexpected behavior
due to write tasks in task management commands have been fixed.

But unexpected behavior due to read tasks in task management commands
have been still observed.

Remaining patches in the patch series will fix the unexpected behavior
due to read tasks in task management commands.

This patch is for ABORT TASK.

ABORT TASK is not supported in SCSI layer yet. But the initiator
doesn't care about the failure is due to not-supported or failure.
It must be avoided that the task management command returns SCSI Good
but some tasks are not aborted and return SCSI Good later. On the other
hand, it is acceptable that the task management command returns
failure but some tasks are partially aborted.

Hence this patch adds operation without checking the support status
in SCSI layer.

iSCSI layer doesn't have pending queue and hence if the target task
is read task and is queued in queued_datain_tasks, it must be
aborted before submitting ABORT TASK to SCSI layer.

Aborting the target task may not complete by an iteration because
submitted read tasks are limited. Hence use poller to complete abortion
by repetition.

Change-Id: I030a8b2f19c2f7c7d2f7b0b2c633579534db631b
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/436076
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-12-10 20:34:11 +00:00
Ziye Yang
c8fd001075 iscsi: fix the primary iscsi task free in queued_datain_tasks
Reason: If the task is queued in scsi layer to handle, we
should free the task after calling the spdk_iscsi_task_cpl.
Otherwise, if only this task is executed (without subread tasks),
the task will be freed by the loop early, which will cause
the segment fault in spdk_iscsi_task_cpl function.

Change-Id: Ifc42399957b24d976af5fd12f6e33459a3ea86ba
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/421706
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
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>
2018-08-15 17:35:38 +00:00
Daniel Verkamp
4a9dce9a48 Use SPDK_CONTAINEROF in a few more places
A few open-coded sequences equivalent to SPDK_CONTAINEROF() were
scattered around; replace them with the macro from spdk/util.h.

Change-Id: I95c6e6838902f411420573399ced7c58c2e4ef84
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/418126
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-07-06 22:47:04 +00:00
Daniel Verkamp
e45437aba7 scsi, iscsi: move task->parent to iSCSI task
The SCSI layer no longer needs to know about the parent/subtask
relationship maintained by iSCSI.

Change-Id: Ia6f7c5367c5b656bd7521ed1abb6d0f713a0500b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393697
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2018-01-05 00:01:37 -05:00
Daniel Verkamp
85f55b7383 scsi, iscsi: move lun_id field to iSCSI task
This is not used in the generic SCSI layer.

Fixes: 8eba104b73 ("iscsi: Fix the bug for hotplug when read IO is
running.")

Change-Id: Ie0715ea0ee5084eaf1321ba2f65f7bfa674c663a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393211
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-03 12:09:57 -05:00
Seth Howell
f03f5e7de8 iscsi: change iscsi_bhs_scsi_req variable names.
These variable names are changed to retain conformity with astyle 3.0.1. Astyle 3.0.1 recognizes 'final' as a keyword and incorrectly formats the iscsi_spec.h file breaking the build. Names were changed to avoid this case and maintain consistency within the struct.

Change-Id: I39c29d768c0ddfd459a9e9212c29cf564dad1963
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/369905
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-18 13:14:16 -04:00
Ben Walker
4185205540 scsi: Remove cb_event. It is no longer necessary.
This is an artifact from a past design. There is no longer
any reason to create an event here - the bdev layer will
correctly queue events and call completions on the correct
thread.

Change-Id: I145dab4046899834c0449ec7380dcbb28215b493
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364831
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-22 10:47:31 -04:00
Daniel Verkamp
133dc1e6ae iscsi: clean up iSCSI/SCSI task conversions
Add a helper function to find the iSCSI task given its nested SCSI task
structure, and use it to remove all casting between spdk_scsi_task and
spdk_iscsi_task.

Change-Id: Idc7c6d0a3b4d53041916d25a1bdecedfb56b94f9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-16 16:45:22 -07:00
Daniel Verkamp
19a9871495 scsi: remove spdk_scsi_task::owner_task_ctr
The SCSI library already provides a callback when the task is released
(free_fn), so the user can update their own task counter.

Change-Id: I7fb13f6fff66dbba2315fd03fb06e49f793be123
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-15 10:12:42 -07:00
Daniel Verkamp
2621c7bdc4 scsi: move bytes_completed to iSCSI task
Change-Id: Iff345f555f94a34fa4a6f86bc11efea704e39735
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-04 10:10:47 -07:00
Daniel Verkamp
7e7ed7ec10 scsi: move data_out_cnt to iSCSI task
Change-Id: I550de37d5088e2273b9d53ab8a2d6134c486fba0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-04 10:10:47 -07:00
Daniel Verkamp
d4da788057 scsi: move desired_data_transfer_length to iSCSI task
Change-Id: I425f9cc7c572b4d819d0aae370f7a96c57d6eac1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-04 10:10:47 -07:00
Daniel Verkamp
414b754579 scsi: remove SCSI task id and add iSCSI task tag
The SCSI layer was not using the task ID for anything; the iSCSI layer
was using it to store the task tag, so move it there and rename it to
"tag" to make its purpose clear.

Change-Id: Ibda4f4e215056116b9be4a3a0264f98bc4c29535
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-04 10:10:47 -07:00
Daniel Verkamp
4ccf74ab3b scsi: move subtask_list to spdk_iscsi_task
The SCSI layer doesn't use subtasks; these are an iSCSI layer concept.

Change-Id: I83871f02362f10fd4ecd4b2a1544eb76bfa53595
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-04 10:10:47 -07:00
Daniel Verkamp
6b91943209 scripts/check_format.sh: check spaces in comments
Fix up all existing spacing errors in comments and add an automated
check for patterns like /*comment*/.

Change-Id: I28f61c93612dc0f8aed66bd509da78e91ea9737e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-24 13:37:41 -07:00
Ziye Yang
6c4a07ecbe scsi: change spdk_put_task to spdk_scsi_task_put
Change-Id: I2598627523b2a78b68d7e7fdadbb7d8ef44592b9
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-29 15:42:29 -07:00
Ben Walker
d29384bf97 iscsi: Add an iscsi library.
Change-Id: I28f3f4723a66f845eb478a6873d7aedb8f5409b8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-03 14:43:40 -07:00