Skip to content

Commit 06c203a

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: iscsi: Force immediate failure during shutdown
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/[email protected] Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 27e9862 commit 06c203a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,11 +2513,17 @@ static void stop_conn_work_fn(struct work_struct *work)
25132513
session = iscsi_session_lookup(sid);
25142514
if (session) {
25152515
if (system_state != SYSTEM_RUNNING) {
2516-
session->recovery_tmo = 0;
2517-
iscsi_if_stop_conn(conn, STOP_CONN_TERM);
2518-
} else {
2519-
iscsi_if_stop_conn(conn, STOP_CONN_RECOVER);
2516+
/*
2517+
* If the user has set up for the session to
2518+
* never timeout then hang like they wanted.
2519+
* For all other cases fail right away since
2520+
* userspace is not going to relogin.
2521+
*/
2522+
if (session->recovery_tmo > 0)
2523+
session->recovery_tmo = 0;
25202524
}
2525+
2526+
iscsi_if_stop_conn(conn, STOP_CONN_RECOVER);
25212527
}
25222528

25232529
list_del_init(&conn->conn_list_err);

0 commit comments

Comments
 (0)