diff mbox series

PATCH] iscsi:report unbind session event when the target has been removed

Message ID 4eab1771-2cb3-8e79-b31c-923652340e99@huawei.com (mailing list archive)
State Superseded
Headers show
Series PATCH] iscsi:report unbind session event when the target has been removed | expand

Commit Message

Wu Bo March 24, 2020, 7:52 a.m. UTC
The daemon is restarted or crashed while logging out of a session.
The unbind session event sent by the kernel is not be processed or be lost.
When the daemon runs again, the session will never be able to logout.

After executing the logout again, the daemon is waiting for the unbind 
event message.
The kernel status has been logged out and the event will not be sent again.

#iscsiadm -m node iqn.xxx -p xx.xx.xx.xx -u &
#service iscsid restart

when iscsid restart done. logout session again report error:
#iscsiadm -m node iqn.xxxxx -p xx.xx.xx.xx -u
Logging out of session [sid: 6, target: iqn.xxxxx, portal: xx.xx.xx.xx,3260]
iscsiadm: Could not logout of [sid: 6, target: iscsiadm -m node 
iqn.xxxxx, portal: xx.xx.xx.xx,3260].
iscsiadm: initiator reported error (9 - internal error)
iscsiadm: Could not logout of all requested sessions

Signed-off-by: Wu Bo <wubo40@huawei.com>
---
  drivers/scsi/scsi_transport_iscsi.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

         target_id = session->target_id;
@@ -2024,6 +2024,8 @@ static void __iscsi_unbind_session(struct 
work_struct *work)
                 ida_simple_remove(&iscsi_sess_ida, target_id);

         scsi_remove_target(&session->dev);
+
+unbind_session_exit:
         iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
         ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n");
  }
--
1.8.3.1

Comments

Lee Duncan March 28, 2020, 12:45 a.m. UTC | #1
On 3/24/20 12:52 AM, Wu Bo wrote:
> The daemon is restarted or crashed while logging out of a session.
> The unbind session event sent by the kernel is not be processed or be lost.
> When the daemon runs again, the session will never be able to logout.
> 
> After executing the logout again, the daemon is waiting for the unbind
> event message.
> The kernel status has been logged out and the event will not be sent again.
> 
> #iscsiadm -m node iqn.xxx -p xx.xx.xx.xx -u &
> #service iscsid restart
> 
> when iscsid restart done. logout session again report error:
> #iscsiadm -m node iqn.xxxxx -p xx.xx.xx.xx -u
> Logging out of session [sid: 6, target: iqn.xxxxx, portal:
> xx.xx.xx.xx,3260]
> iscsiadm: Could not logout of [sid: 6, target: iscsiadm -m node
> iqn.xxxxx, portal: xx.xx.xx.xx,3260].
> iscsiadm: initiator reported error (9 - internal error)
> iscsiadm: Could not logout of all requested sessions
> 
> Signed-off-by: Wu Bo <wubo40@huawei.com>
> ---
>  drivers/scsi/scsi_transport_iscsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_transport_iscsi.c
> b/drivers/scsi/scsi_transport_iscsi.c
> index dfc726f..443ace0 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -2012,7 +2012,7 @@ static void __iscsi_unbind_session(struct
> work_struct *work)
>         if (session->target_id == ISCSI_MAX_TARGET) {
>                 spin_unlock_irqrestore(&session->lock, flags);
>                 mutex_unlock(&ihost->mutex);
> -               return;
> +               goto unbind_session_exit;
>         }
> 
>         target_id = session->target_id;
> @@ -2024,6 +2024,8 @@ static void __iscsi_unbind_session(struct
> work_struct *work)
>                 ida_simple_remove(&iscsi_sess_ida, target_id);
> 
>         scsi_remove_target(&session->dev);
> +
> +unbind_session_exit:
>         iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
>         ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n");
>  }
> -- 
> 1.8.3.1
> 

Reviewed-by: Lee Duncan <lduncan@suse.com>
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index dfc726f..443ace0 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2012,7 +2012,7 @@  static void __iscsi_unbind_session(struct 
work_struct *work)
         if (session->target_id == ISCSI_MAX_TARGET) {
                 spin_unlock_irqrestore(&session->lock, flags);
                 mutex_unlock(&ihost->mutex);
-               return;
+               goto unbind_session_exit;
         }