When execute iscsi_task_mgmt_lun_reset_async function,
pdus are already removed from waitpdu list. In iscsi_service
function, this will call iscsi_process_pdu and release
pdu from waitpdu again, which cause segmentation fault.
Whether waitpud list is NULL should be checked here to avoid
the problem.
Signed-off-by: geruijun <geruijun@huawei.com>
If invalid option is input with iscsi-ls,such as "iscsi-ls -a iscsi://", the command just stuck here and do not print useful information for the user to correct.
Fix this problem with getopt_long.
According to the man page and help info, --debug=integer can specify the
debug_level, while it would report following error:
iscsi-swp --debug=1
iscsi-swp: option '--debug' doesn't allow an argument
According to the man page and help info, --debug=integer can specify the
debug_level, while it would report following error:
iscsi-inq --debug=2
iscsi-inq: option '--debug' doesn't allow an argument
It's because the iscsi-inq code did not handle this parameters
correctly. So here we just correct it.
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
If a test sets the use_immediate_data parameter to ISCSI_IMMEDIATE_DATA_NO
for the iSCSI context, then the test expects that a data associated with
the Write command to be sent in a separate PDU.
But if for execute the command it is necessary to login on a target then
the use_immediate_data was previously set, will be rewrite during
the processing of the Login Response packet.
This happen during the iSCSI.iSCSIdatasn.iSCSIDataSnInvalid
(test_iscsi_datasn_invalid.c) test:
--> iSCSI 114 SCSI: Write(10) LUN: 0x01 (LBA: 0x00000064, Len: 1)
<-- iSCSI 114 Ready To Transfer
--> iSCSI 578 SCSI: Data Out LUN: 0x01 (Write(10) Request Data)
--> iSCSI 550 Login Command
Here we lose use_immediate_data value for iSCSI session.
<-- iSCSI 426 Login Response (Success)
--> iSCSI 114 SCSI: Test Unit Ready LUN: 0x01
<-- iSCSI 114 SCSI: Response LUN: 0x01 (Test Unit Ready) (Good)
And this Write command includes payload into iSCSI PDU packet, but should not do it.
--> iSCSI 578 SCSI: Write(10) LUN: 0x01 (LBA: 0x00000064, Len: 1)SCSI: Data Out LUN: 0x01 (Write(10) Request Data)
<-- iSCSI 114 SCSI: Response LUN: 0x01 (Write(10)) (Good)
--> iSCSI 114 SCSI: Write(10) LUN: 0x01 (LBA: 0x00000064, Len: 2)
<-- iSCSI 114 Ready To Transfer
--> iSCSI 578 SCSI: Data Out LUN: 0x01 (Write(10) Request Data)
--> iSCSI 626 SCSI: Data Out LUN: 0x01 (Write(10) Request Data)
Signed-off-by: Sergey Samoylenko <s.samoylenko@yadro.com>
In iscsi_send_data_out() a PDU is allocated, but there is no error
handling logic to free it if the PDU cannot be queued.
iscsi_allocate_pdu() may allocate memory for the PDU. This memory may be
leaked if iscsi_queue_pdu() fails since there is no call to free it.
Orignally there was a free() call but it was removed as a part of a
cleanup adding checks for NULL pdu callbacks.
Fixes: 423b82efa4 ("pdu: check callback for NULL everywhere")
Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
iscsi-pr uses libiscsi to connect target and issues PR command.
In most cases, iscsi-pr use the same parameters as sg_persist(from sg3-utils).
For example, use iscsi-pr to dump keys by command:
~# ./utils/iscsi-pr --read-keys iscsi://192.168.122.44/iqn.2003-01.org.linux-iscsi.bytedance.x8664:sn.a6b7bff3d509/0 -i iqn.2005-03.org.open-iscsi:12345678
PR generation=0x20, 19 registered reservation keys follow:
0xabcd1234
0xabcd
0xabcd
0xabc
A few command is not implemented in this patch, add them if necessary
in future.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
If a connection attempt is hung, then iscsi_reconnect() won't do anything. This
makes sense if we'd just re-try to connect to the same target, but if (for
example) login redirect might point us to a different, healthy, target, it
should be possible to restart the full connection process on request.
Signed-off-by: John Levon <john.levon@nutanix.com>
If doesn't support the report_supported_opcodes, the task will not be
freed in REPORT_SUPPORTED_OPCODES.
Change-Id: I1e251eec518721fb35e51013621aa61865d4b46b
Signed-off-by: Li Feng <fengli@smartx.com>
Using -Wno-strict-aliasing is almost always wrong. If any code would be
introduced in the future that violates the strict aliasing rules, please
use -fno-strict-aliasing instead.
C++ requires explicit conversions from a void to a non-void pointer.
Signed-off-by: Li Feng <fengli@smartx.com>
[ bvanassche: edited commit message, removed casts and changed the declaration
type ]
CU_PASS() needs to be coupled with a return to actually skip the test.
Similarly, the CU_PASS message isn't printed, so a logging() call is
also needed here.
Signed-off-by: David Disseldorp <ddiss@suse.de>
In one of recent commits the argument passed to m4_esyscmd()
macro was switched to its unescaped version. This is not correct
because package version is then defined as "Version 1.19.0"
instead of just "1.19.0".
Fixes: cb4489776b
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Change the reference to the 'src' directory into a reference to the 'utils'
directory since commit c07779cfa7 ("AUTOTOOLS: Add a Makefile.am for the
iscsi-* utilities") renamed the 'src' directory into 'utils'.
Document the purpose of the test-tool directory.
Fix the link to the release tarballs.
This file has been reformatted with clang-format --style=file and the Linux
kernel .clang-format style file.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Instead of adding __attribute__((unused)) to unused arguments, add the
-Wno-unused-parameter compiler flag.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Instead of defining the macro _R_(), define __attribute__() as a macro for
compilers that do not support __attribute__(), namely Microsoft Visual
Studio.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>