Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: iscsi: Use the session workqueue for recovery

Use the session workqueue for recovery and unbinding. If there are delays
during device blocking/cleanup then it will no longer affect other
sessions.

Link: https://lore.kernel.org/r/20220226230435.38733-6-michael.christie@oracle.com
Reviewed-by: Chris Leech <cleech@redhat.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
7cb6683c 5842ea36

+4 -16
+4 -16
drivers/scsi/scsi_transport_iscsi.c
··· 87 87 }; 88 88 89 89 static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ 90 - static struct workqueue_struct *iscsi_eh_timer_workq; 91 90 92 91 static struct workqueue_struct *iscsi_conn_cleanup_workq; 93 92 ··· 1912 1913 if (!cancel_work_sync(&session->block_work)) 1913 1914 cancel_delayed_work_sync(&session->recovery_work); 1914 1915 1915 - queue_work(iscsi_eh_timer_workq, &session->unblock_work); 1916 + queue_work(session->workq, &session->unblock_work); 1916 1917 /* 1917 1918 * Blocking the session can be done from any context so we only 1918 1919 * queue the block work. Make sure the unblock work has completed ··· 1936 1937 scsi_target_block(&session->dev); 1937 1938 ISCSI_DBG_TRANS_SESSION(session, "Completed SCSI target blocking\n"); 1938 1939 if (session->recovery_tmo >= 0) 1939 - queue_delayed_work(iscsi_eh_timer_workq, 1940 + queue_delayed_work(session->workq, 1940 1941 &session->recovery_work, 1941 1942 session->recovery_tmo * HZ); 1942 1943 } 1943 1944 1944 1945 void iscsi_block_session(struct iscsi_cls_session *session) 1945 1946 { 1946 - queue_work(iscsi_eh_timer_workq, &session->block_work); 1947 + queue_work(session->workq, &session->block_work); 1947 1948 } 1948 1949 EXPORT_SYMBOL_GPL(iscsi_block_session); 1949 1950 ··· 4850 4851 goto unregister_flashnode_bus; 4851 4852 } 4852 4853 4853 - iscsi_eh_timer_workq = alloc_workqueue("%s", 4854 - WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, 4855 - 1, "iscsi_eh"); 4856 - if (!iscsi_eh_timer_workq) { 4857 - err = -ENOMEM; 4858 - goto release_nls; 4859 - } 4860 - 4861 4854 iscsi_conn_cleanup_workq = alloc_workqueue("%s", 4862 4855 WQ_SYSFS | WQ_MEM_RECLAIM | WQ_UNBOUND, 0, 4863 4856 "iscsi_conn_cleanup"); 4864 4857 if (!iscsi_conn_cleanup_workq) { 4865 4858 err = -ENOMEM; 4866 - goto destroy_wq; 4859 + goto release_nls; 4867 4860 } 4868 4861 4869 4862 return 0; 4870 4863 4871 - destroy_wq: 4872 - destroy_workqueue(iscsi_eh_timer_workq); 4873 4864 release_nls: 4874 4865 netlink_kernel_release(nls); 4875 4866 unregister_flashnode_bus: ··· 4882 4893 static void __exit iscsi_transport_exit(void) 4883 4894 { 4884 4895 destroy_workqueue(iscsi_conn_cleanup_workq); 4885 - destroy_workqueue(iscsi_eh_timer_workq); 4886 4896 netlink_kernel_release(nls); 4887 4897 bus_unregister(&iscsi_flashnode_bus); 4888 4898 transport_class_unregister(&iscsi_connection_class);