From c7d8a1fa7d8a5f5753c0a7b3462f9e99abc36dec Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 11 Jun 2015 16:43:08 +0000 Subject: [PATCH] Merge r6017 from the iser branch git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@6277 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/isert_login.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index 9fc4f3cc4..f21730b41 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -309,7 +309,6 @@ static void isert_delete_conn_dev(struct isert_conn_dev *conn_dev) BUG_ON(conn_dev->conn == NULL); isert_close_connection(conn_dev->conn); } - list_del(&conn_dev->conn_list_entry); } static int isert_listen_release(struct inode *inode, struct file *filp) @@ -317,22 +316,13 @@ static int isert_listen_release(struct inode *inode, struct file *filp) struct isert_listener_dev *dev = filp->private_data; struct isert_conn_dev *conn_dev; - /* No need for locking here, since the chardev is being closed */ - while (!list_empty(&dev->new_conn_list)) { - conn_dev = list_first_entry(&dev->new_conn_list, - struct isert_conn_dev, - conn_list_entry); - + spin_lock(&isert_listen_dev.conn_lock); + list_for_each_entry(conn_dev, &dev->new_conn_list, conn_list_entry) isert_delete_conn_dev(conn_dev); - } - - while (!list_empty(&dev->curr_conn_list)) { - conn_dev = list_first_entry(&dev->curr_conn_list, - struct isert_conn_dev, - conn_list_entry); + list_for_each_entry(conn_dev, &dev->curr_conn_list, conn_list_entry) isert_delete_conn_dev(conn_dev); - } + spin_unlock(&isert_listen_dev.conn_lock); atomic_inc(&dev->available); return 0;