lkml.org 
[lkml]   [2021]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.13 663/800] scsi: iscsi: Force immediate failure during shutdown
    Date
    From: Mike Christie <michael.christie@oracle.com>

    [ Upstream commit 06c203a5566beecebb1f8838d026de8a61c8df71 ]

    If the system is not up, we can just fail immediately since iscsid is not
    going to ever answer our netlink events. We are already setting the
    recovery_tmo to 0, but by passing stop_conn STOP_CONN_TERM we never will
    block the session and start the recovery timer, because for that flag
    userspace will do the unbind and destroy events which would remove the
    devices and wake up and kill the eh.

    Since the conn is dead and the system is going dowm this just has us use
    STOP_CONN_RECOVER with recovery_tmo=0 so we fail immediately. However, if
    the user has set the recovery_tmo=-1 we let the system hang like they
    requested since they might have used that setting for specific reasons
    (one known reason is for buggy cluster software).

    Link: https://lore.kernel.org/r/20210525181821.7617-5-michael.christie@oracle.com
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/scsi/scsi_transport_iscsi.c | 14 ++++++++++----
    1 file changed, 10 insertions(+), 4 deletions(-)

    diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
    index 82491343e94a..d134156d67f0 100644
    --- a/drivers/scsi/scsi_transport_iscsi.c
    +++ b/drivers/scsi/scsi_transport_iscsi.c
    @@ -2513,11 +2513,17 @@ static void stop_conn_work_fn(struct work_struct *work)
    session = iscsi_session_lookup(sid);
    if (session) {
    if (system_state != SYSTEM_RUNNING) {
    - session->recovery_tmo = 0;
    - iscsi_if_stop_conn(conn, STOP_CONN_TERM);
    - } else {
    - iscsi_if_stop_conn(conn, STOP_CONN_RECOVER);
    + /*
    + * If the user has set up for the session to
    + * never timeout then hang like they wanted.
    + * For all other cases fail right away since
    + * userspace is not going to relogin.
    + */
    + if (session->recovery_tmo > 0)
    + session->recovery_tmo = 0;
    }
    +
    + iscsi_if_stop_conn(conn, STOP_CONN_RECOVER);
    }

    list_del_init(&conn->conn_list_err);
    --
    2.30.2


    \
     
     \ /
      Last update: 2021-07-12 11:10    [W:4.039 / U:0.240 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site