提交 83e5201a 编写于 作者: M Mike Christie 提交者: Zheng Zengkai

scsi: iscsi: Force immediate failure during shutdown

stable inclusion
from stable-v5.10.112
commit 4029a1e992fc6a0e29ff56c74a9632317fe76022
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5HL0X

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4029a1e992fc6a0e29ff56c74a9632317fe76022

--------------------------------

[ Upstream commit 06c203a5 ]

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.comSigned-off-by: NMike Christie <michael.christie@oracle.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 4d3c7d3a
......@@ -2508,11 +2508,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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册