Re: iscsiadm error "Could not load transport iser"

2022-11-25 Thread Luis Navarro
I'm using two ConnectX-5 Ethernet cards (MCSX515A-CCAT) direct connected 
with a QSFP28 DAC.

FWIW, after I submitted my question, I *think* I got ISER to work with the 
same target but using ESXi 6.7 as the initiator.  But I'd still like to use 
iscsiadm for debugging.

My best guess is that I need to install an optional Ubuntu package to get 
those "iser" devices under the "iscsi_transport" directory?
On Friday, November 25, 2022 at 9:33:34 AM UTC-8 The Lee-Man wrote:

> The iser transport is only supported for some cards. It's normally an 
> infiniband transport.
>
> Do you have a CNA card (and infrastructure) that supports iser?
>
> On Tuesday, November 22, 2022 at 11:28:47 PM UTC-8 Luis Navarro wrote:
>
>> Hi all,
>>
>> I'm trying to test a new Ubuntu 22.04.1 LIO iSCSI target with iscsiadm 
>> 2.1.5 (installed via "apt").  iscsiadm works fine over "tcp" transport but 
>> always fails over the "iser" transport with the following error:
>>
>> iscsiadm: Could not load transport iser.Dropping interface iface0.
>>
>> Here are the commands I ran:
>>
>> $ sudo iscsiadm -m iface -I iface0 --op=new
>> $ sudo iscsiadm -m iface -I iface0 -o update -n iface.transport_name -v 
>> iser
>> $ sudo iscsiadm -m discovery -t st -p 192.168.25.5:3260 -I iface0 -d 8
>> iscsiadm: Max file limits 1024 1048576
>> iscsiadm: updating defaults from '/etc/iscsi/iscsid.conf'
>> iscsiadm: updated 'discovery.sendtargets.iscsi.MaxRecvDataSegmentLength', 
>> '32768' => '32768'
>> iscsiadm: updated 'node.startup', 'manual' => 'manual'
>> iscsiadm: updated 'node.leading_login', 'No' => 'No'
>> iscsiadm: updated 'node.session.timeo.replacement_timeout', '120' => '120'
>> iscsiadm: updated 'node.conn[0].timeo.login_timeout', '30' => '15'
>> iscsiadm: updated 'node.conn[0].timeo.logout_timeout', '15' => '15'
>> iscsiadm: updated 'node.conn[0].timeo.noop_out_interval', '5' => '5'
>> iscsiadm: updated 'node.conn[0].timeo.noop_out_timeout', '5' => '5'
>> iscsiadm: updated 'node.session.err_timeo.abort_timeout', '15' => '15'
>> iscsiadm: updated 'node.session.err_timeo.lu_reset_timeout', '30' => '30'
>> iscsiadm: updated 'node.session.err_timeo.tgt_reset_timeout', '30' => '30'
>> iscsiadm: updated 'node.session.initial_login_retry_max', '4' => '8'
>> iscsiadm: updated 'node.session.cmds_max', '128' => '128'
>> iscsiadm: updated 'node.session.queue_depth', '32' => '32'
>> iscsiadm: updated 'node.session.xmit_thread_priority', '-20' => '-20'
>> iscsiadm: updated 'node.session.iscsi.InitialR2T', 'No' => 'No'
>> iscsiadm: updated 'node.session.iscsi.ImmediateData', 'Yes' => 'Yes'
>> iscsiadm: updated 'node.session.iscsi.FirstBurstLength', '262144' => 
>> '262144'
>> iscsiadm: updated 'node.session.iscsi.MaxBurstLength', '16776192' => 
>> '16776192'
>> iscsiadm: updated 'node.conn[0].iscsi.MaxRecvDataSegmentLength', '262144' 
>> => '262144'
>> iscsiadm: updated 'node.conn[0].iscsi.MaxXmitDataSegmentLength', '0' => 
>> '0'
>> iscsiadm: updated 'node.session.nr_sessions', '1' => '1'
>> iscsiadm: updated 'node.session.reopen_max', '0' => '0'
>> iscsiadm: updated 'node.session.iscsi.FastAbort', 'Yes' => 'Yes'
>> iscsiadm: updated 'node.session.scan', 'auto' => 'auto'
>> iscsiadm: looking for iface conf /etc/iscsi/ifaces/iface0
>> iscsiadm: updated 'iface.iscsi_ifacename', 'iface0' => 'iface0'
>> iscsiadm: updated 'iface.prefix_len', '0' => '0'
>> iscsiadm: updated 'iface.transport_name', '' => 'iser'
>> iscsiadm: updated 'iface.vlan_id', '0' => '0'
>> iscsiadm: updated 'iface.vlan_priority', '0' => '0'
>> iscsiadm: updated 'iface.iface_num', '0' => '0'
>> iscsiadm: updated 'iface.mtu', '0' => '0'
>> iscsiadm: updated 'iface.port', '0' => '0'
>> iscsiadm: updated 'iface.tos', '0' => '0'
>> iscsiadm: updated 'iface.ttl', '0' => '0'
>> iscsiadm: updated 'iface.tcp_wsf', '0' => '0'
>> iscsiadm: updated 'iface.tcp_timer_scale', '0' => '0'
>> iscsiadm: updated 'iface.def_task_mgmt_timeout', '0' => '0'
>> iscsiadm: updated 'iface.erl', '0' => '0'
>> iscsiadm: updated 'iface.max_receive_data_len', '0' => '0'
>> iscsiadm: updated 'iface.first_burst_len', '0' => '0'
>> iscsiadm: updated 'iface.max_outstanding_r2t', '0' => '0'
>> iscsiadm: updated 'iface.max_burst_len', '0' => '0'
>> iscsiadm: in read_transports
>> iscsiadm: Adding new transport tcp
>> iscsiadm: Matched transport tcp
>> iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/tcp'/'handle'
>> iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/tcp'/'caps'
>> iscsiadm: in read_transports
>> iscsiadm: Updating transport tcp
>> iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/tcp'/'handle'
>> iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/tcp'/'caps'
>> iscsiadm: Could not load transport iser.Dropping interface iface0.
>>
>> Looking at the /sys/class/iscsi_transport and 
>> /sys/devices/virtual/iscsi_transport directories on the client system, I 
>> only see "tcp".  Should I also be seeing "iser"?  Is there an extra package 
>> I need to install or step I need 

Re: iscsiadm error "Could not load transport iser"

2022-11-25 Thread The Lee-Man
The iser transport is only supported for some cards. It's normally an 
infiniband transport.

Do you have a CNA card (and infrastructure) that supports iser?

On Tuesday, November 22, 2022 at 11:28:47 PM UTC-8 Luis Navarro wrote:

> Hi all,
>
> I'm trying to test a new Ubuntu 22.04.1 LIO iSCSI target with iscsiadm 
> 2.1.5 (installed via "apt").  iscsiadm works fine over "tcp" transport but 
> always fails over the "iser" transport with the following error:
>
> iscsiadm: Could not load transport iser.Dropping interface iface0.
>
> Here are the commands I ran:
>
> $ sudo iscsiadm -m iface -I iface0 --op=new
> $ sudo iscsiadm -m iface -I iface0 -o update -n iface.transport_name -v 
> iser
> $ sudo iscsiadm -m discovery -t st -p 192.168.25.5:3260 -I iface0 -d 8
> iscsiadm: Max file limits 1024 1048576
> iscsiadm: updating defaults from '/etc/iscsi/iscsid.conf'
> iscsiadm: updated 'discovery.sendtargets.iscsi.MaxRecvDataSegmentLength', 
> '32768' => '32768'
> iscsiadm: updated 'node.startup', 'manual' => 'manual'
> iscsiadm: updated 'node.leading_login', 'No' => 'No'
> iscsiadm: updated 'node.session.timeo.replacement_timeout', '120' => '120'
> iscsiadm: updated 'node.conn[0].timeo.login_timeout', '30' => '15'
> iscsiadm: updated 'node.conn[0].timeo.logout_timeout', '15' => '15'
> iscsiadm: updated 'node.conn[0].timeo.noop_out_interval', '5' => '5'
> iscsiadm: updated 'node.conn[0].timeo.noop_out_timeout', '5' => '5'
> iscsiadm: updated 'node.session.err_timeo.abort_timeout', '15' => '15'
> iscsiadm: updated 'node.session.err_timeo.lu_reset_timeout', '30' => '30'
> iscsiadm: updated 'node.session.err_timeo.tgt_reset_timeout', '30' => '30'
> iscsiadm: updated 'node.session.initial_login_retry_max', '4' => '8'
> iscsiadm: updated 'node.session.cmds_max', '128' => '128'
> iscsiadm: updated 'node.session.queue_depth', '32' => '32'
> iscsiadm: updated 'node.session.xmit_thread_priority', '-20' => '-20'
> iscsiadm: updated 'node.session.iscsi.InitialR2T', 'No' => 'No'
> iscsiadm: updated 'node.session.iscsi.ImmediateData', 'Yes' => 'Yes'
> iscsiadm: updated 'node.session.iscsi.FirstBurstLength', '262144' => 
> '262144'
> iscsiadm: updated 'node.session.iscsi.MaxBurstLength', '16776192' => 
> '16776192'
> iscsiadm: updated 'node.conn[0].iscsi.MaxRecvDataSegmentLength', '262144' 
> => '262144'
> iscsiadm: updated 'node.conn[0].iscsi.MaxXmitDataSegmentLength', '0' => '0'
> iscsiadm: updated 'node.session.nr_sessions', '1' => '1'
> iscsiadm: updated 'node.session.reopen_max', '0' => '0'
> iscsiadm: updated 'node.session.iscsi.FastAbort', 'Yes' => 'Yes'
> iscsiadm: updated 'node.session.scan', 'auto' => 'auto'
> iscsiadm: looking for iface conf /etc/iscsi/ifaces/iface0
> iscsiadm: updated 'iface.iscsi_ifacename', 'iface0' => 'iface0'
> iscsiadm: updated 'iface.prefix_len', '0' => '0'
> iscsiadm: updated 'iface.transport_name', '' => 'iser'
> iscsiadm: updated 'iface.vlan_id', '0' => '0'
> iscsiadm: updated 'iface.vlan_priority', '0' => '0'
> iscsiadm: updated 'iface.iface_num', '0' => '0'
> iscsiadm: updated 'iface.mtu', '0' => '0'
> iscsiadm: updated 'iface.port', '0' => '0'
> iscsiadm: updated 'iface.tos', '0' => '0'
> iscsiadm: updated 'iface.ttl', '0' => '0'
> iscsiadm: updated 'iface.tcp_wsf', '0' => '0'
> iscsiadm: updated 'iface.tcp_timer_scale', '0' => '0'
> iscsiadm: updated 'iface.def_task_mgmt_timeout', '0' => '0'
> iscsiadm: updated 'iface.erl', '0' => '0'
> iscsiadm: updated 'iface.max_receive_data_len', '0' => '0'
> iscsiadm: updated 'iface.first_burst_len', '0' => '0'
> iscsiadm: updated 'iface.max_outstanding_r2t', '0' => '0'
> iscsiadm: updated 'iface.max_burst_len', '0' => '0'
> iscsiadm: in read_transports
> iscsiadm: Adding new transport tcp
> iscsiadm: Matched transport tcp
> iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/tcp'/'handle'
> iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/tcp'/'caps'
> iscsiadm: in read_transports
> iscsiadm: Updating transport tcp
> iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/tcp'/'handle'
> iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/tcp'/'caps'
> iscsiadm: Could not load transport iser.Dropping interface iface0.
>
> Looking at the /sys/class/iscsi_transport and 
> /sys/devices/virtual/iscsi_transport directories on the client system, I 
> only see "tcp".  Should I also be seeing "iser"?  Is there an extra package 
> I need to install or step I need to take to get "iser" devices under the 
> "iscsi_transport" directory?
>
> Thanks!
> Luis
>

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/9d24cea1-f8a8-43e9-9982-c9e6df0cf770n%40googlegroups.com.


[PATCH v7] scsi:iscsi: Fix multiple iscsi session unbind event sent to userspace

2022-11-25 Thread 'Wenchao Hao' via open-iscsi
I found an issue that kernel would send ISCSI_KEVENT_UNBIND_SESSION
for multiple times which should be fixed.

This patch introduce target_state in iscsi_cls_session to make
sure session would send only one ISCSI_KEVENT_UNBIND_SESSION.

But this would break issue fixed in commit 13e60d3ba287 ("scsi: iscsi:
Report unbind session event when the target has been removed"). The issue
is iscsid died for any reason after it send unbind session to kernel, once
iscsid restart again, it loss kernel's ISCSI_KEVENT_UNBIND_SESSION event.

Now kernel think iscsi_cls_session has already sent an
ISCSI_KEVENT_UNBIND_SESSION event and would not send it any more. Which
would cause userspace unable to logout. Actually the session is in
invalid state(it's target_id is INVALID), iscsid should not sync this
session in it's restart.

So we need to check session's target state during iscsid restart,
if session is in unbound state, do not sync this session and perform
session teardown. It's reasonable because once a session is unbound, we
can not recover it any more(mainly because it's target id is INVALID)

V7:
- Define target state to string map and refer this map directly
- Cleanup __iscsi_unbind_session, drop check for session's
  target_id == ISCSI_MAX_TARGET since it can be handled by target_state

V6:
- Set target state to ALLOCATED in iscsi_add_session
- Rename state BOUND to SCANNED
- Make iscsi_session_target_state_name() more efficient

V5:
- Add ISCSI_SESSION_TARGET_ALLOCATED to indicate the session's
  target has been allocated but not scanned yet. We should
  sync this session and scan this session when iscsid restarted.

V4:
- Move debug print out of spinlock critical section

V3:
- Make target bind state to a state kind rather than a bool.

V2:
- Using target_unbound rather than state to indicate session has been
  unbound

Signed-off-by: Wenchao Hao 
---
 drivers/scsi/scsi_transport_iscsi.c | 47 ++---
 include/scsi/scsi_transport_iscsi.h |  9 ++
 2 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index cd3db9684e52..812578c20fe5 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1676,6 +1676,13 @@ static const char *iscsi_session_state_name(int state)
return name;
 }
 
+static char *iscsi_session_target_state_name[] = {
+   [ISCSI_SESSION_TARGET_UNBOUND]   = "UNBOUND",
+   [ISCSI_SESSION_TARGET_ALLOCATED] = "ALLOCATED",
+   [ISCSI_SESSION_TARGET_SCANNED]   = "SCANNED",
+   [ISCSI_SESSION_TARGET_UNBINDING] = "UNBINDING",
+};
+
 int iscsi_session_chkready(struct iscsi_cls_session *session)
 {
int err;
@@ -1785,9 +1792,13 @@ static int iscsi_user_scan_session(struct device *dev, 
void *data)
if ((scan_data->channel == SCAN_WILD_CARD ||
 scan_data->channel == 0) &&
(scan_data->id == SCAN_WILD_CARD ||
-scan_data->id == id))
+scan_data->id == id)) {
scsi_scan_target(>dev, 0, id,
 scan_data->lun, scan_data->rescan);
+   spin_lock_irqsave(>lock, flags);
+   session->target_state = ISCSI_SESSION_TARGET_SCANNED;
+   spin_unlock_irqrestore(>lock, flags);
+   }
}
 
 user_scan_exit:
@@ -1960,31 +1971,41 @@ static void __iscsi_unbind_session(struct work_struct 
*work)
struct iscsi_cls_host *ihost = shost->shost_data;
unsigned long flags;
unsigned int target_id;
+   bool remove_target = true;
 
ISCSI_DBG_TRANS_SESSION(session, "Unbinding session\n");
 
/* Prevent new scans and make sure scanning is not in progress */
mutex_lock(>mutex);
spin_lock_irqsave(>lock, flags);
-   if (session->target_id == ISCSI_MAX_TARGET) {
+   if (session->target_state == ISCSI_SESSION_TARGET_ALLOCATED) {
+   remove_target = false;
+   } else if (session->target_state != ISCSI_SESSION_TARGET_SCANNED) {
spin_unlock_irqrestore(>lock, flags);
mutex_unlock(>mutex);
-   goto unbind_session_exit;
+   ISCSI_DBG_TRANS_SESSION(session,
+   "Skipping target unbinding: Session is 
unbound/unbinding.\n");
+   return;
}
 
+   session->target_state = ISCSI_SESSION_TARGET_UNBINDING;
target_id = session->target_id;
session->target_id = ISCSI_MAX_TARGET;
spin_unlock_irqrestore(>lock, flags);
mutex_unlock(>mutex);
 
-   scsi_remove_target(>dev);
+   if (remove_target)
+   scsi_remove_target(>dev);
 
if (session->ida_used)
ida_free(_sess_ida, target_id);
 
-unbind_session_exit:
iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
ISCSI_DBG_TRANS_SESSION(session,