diff mbox series

[v3,1/6] scsi: iscsi: force immediate failure during shutdown

Message ID 20210424221755.124438-2-michael.christie@oracle.com
State New
Headers show
Series iscsi: Fix in kernel conn failure handling | expand

Commit Message

Mike Christie April 24, 2021, 10:17 p.m. UTC
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.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Lee Duncan April 28, 2021, 7 p.m. UTC | #1
On 4/24/21 3:17 PM, Mike Christie wrote:
> 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.

> 

> Signed-off-by: Mike Christie <michael.christie@oracle.com>

> ---

>  drivers/scsi/scsi_transport_iscsi.c | 6 +++---

>  1 file changed, 3 insertions(+), 3 deletions(-)

> 

> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c

> index 82491343e94a..0cd9f2090993 100644

> --- a/drivers/scsi/scsi_transport_iscsi.c

> +++ b/drivers/scsi/scsi_transport_iscsi.c

> @@ -2513,11 +2513,11 @@ static void stop_conn_work_fn(struct work_struct *work)

>  		session = iscsi_session_lookup(sid);

>  		if (session) {

>  			if (system_state != SYSTEM_RUNNING) {

> +				/* Force recovery to fail immediately */

>  				session->recovery_tmo = 0;

> -				iscsi_if_stop_conn(conn, STOP_CONN_TERM);

> -			} else {

> -				iscsi_if_stop_conn(conn, STOP_CONN_RECOVER);

>  			}

> +

> +			iscsi_if_stop_conn(conn, STOP_CONN_RECOVER);

>  		}

>  

>  		list_del_init(&conn->conn_list_err);

> 


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 82491343e94a..0cd9f2090993 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2513,11 +2513,11 @@  static void stop_conn_work_fn(struct work_struct *work)
 		session = iscsi_session_lookup(sid);
 		if (session) {
 			if (system_state != SYSTEM_RUNNING) {
+				/* Force recovery to fail immediately */
 				session->recovery_tmo = 0;
-				iscsi_if_stop_conn(conn, STOP_CONN_TERM);
-			} else {
-				iscsi_if_stop_conn(conn, STOP_CONN_RECOVER);
 			}
+
+			iscsi_if_stop_conn(conn, STOP_CONN_RECOVER);
 		}
 
 		list_del_init(&conn->conn_list_err);