From a892d7b0b3d09d2bfd21fe601e64560d1b8b7df5 Mon Sep 17 00:00:00 2001 From: Yan Burman Date: Wed, 19 Mar 2014 14:30:48 +0000 Subject: [PATCH] isert: Avoid hanging scst_mgmtd in case of login response send failure The following is seen if isert_login_rsp_tx fails, since we do not destroy the created sysfs. [ 840.532111] INFO: task scst_mgmtd:4614 blocked for more than 120 seconds. [ 840.532174] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 840.532230] scst_mgmtd D ffff8800371c4ee0 0 4614 2 0x00000000 [ 840.532233] ffff8800378d1bd8 0000000000000046 ffff8800378d1b78 ffff88007e513ec0 [ 840.532236] ffff8800378d1fd8 ffff8800378d1fd8 ffff8800378d1fd8 0000000000013ec0 [ 840.532238] ffff880077b28000 ffff8800379c9740 ffff8800378d1bc8 7fffffffffffffff [ 840.532241] Call Trace: [ 840.532249] [] schedule+0x29/0x70 [ 840.532253] [] schedule_timeout+0x1e5/0x250 [ 840.532259] [] ? console_unlock+0x1a/0x30 [ 840.532263] [] wait_for_common+0xdf/0x180 [ 840.532286] [] ? debug_print_with_prefix+0x165/0x1f0 [scst] [ 840.532289] [] ? try_to_wake_up+0x200/0x200 [ 840.532291] [] wait_for_completion+0x1d/0x20 [ 840.532302] [] scst_kobject_put_and_wait+0x177/0x220 [scst] [ 840.532314] [] scst_sess_sysfs_del+0xb3/0x180 [scst] [ 840.532324] [] scst_free_session+0xaa/0x2c0 [scst] [ 840.532326] [] ? mutex_lock+0x1d/0x50 [ 840.532336] [] scst_free_session_callback+0x9c/0x170 [scst] [ 840.532343] [] ? __raw_spin_unlock_irq+0xe/0x10 [scst] [ 840.532350] [] scst_global_mgmt_thread+0x2e0/0x560 [scst] [ 840.532354] [] ? add_wait_queue+0x60/0x60 [ 840.532362] [] ? scst_register_session_non_gpl+0x20/0x20 [scst] [ 840.532364] [] kthread+0xc0/0xd0 [ 840.532366] [] ? flush_kthread_worker+0xb0/0xb0 [ 840.532369] [] ret_from_fork+0x7c/0xb0 [ 840.532372] [] ? flush_kthread_worker+0xb0/0xb0 Signed-off-by: Yan Burman git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@5342 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/isert_login.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index 0cbfef731..332f07cda 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -241,16 +241,9 @@ int isert_conn_alloc(struct iscsi_session *session, if (unlikely(res)) goto cleanup_conn; -#ifndef CONFIG_SCST_PROC - res = conn_sysfs_add(conn); - if (unlikely(res)) - goto cleanup_iscsi_conn; -#endif - conn->rd_state = 1; isert_dev_release(dev); - list_add_tail(&conn->conn_list_entry, &session->conn_list); res = isert_login_rsp_tx(cmnd, true, false); vunmap(dev->sg_virt); dev->sg_virt = NULL; @@ -258,12 +251,19 @@ int isert_conn_alloc(struct iscsi_session *session, if (unlikely(res)) goto cleanup_iscsi_conn; +#ifndef CONFIG_SCST_PROC + res = conn_sysfs_add(conn); + if (unlikely(res)) + goto cleanup_iscsi_conn; +#endif + + list_add_tail(&conn->conn_list_entry, &session->conn_list); + goto out; cleanup_iscsi_conn: if (conn->nop_in_interval > 0) cancel_delayed_work_sync(&conn->nop_in_delayed_work); - list_del(&conn->conn_list_entry); cleanup_conn: conn->session = NULL; isert_close_connection(conn);