[PATCH] "Delete and Add event instead of modifying on the fly"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This applies cleanly on the "thread" branch.
---
When running thread per target feature under valgrind I occasionaly
saw some race where both the main thread and the target's thread are
in iscsi_tcp_event_handler(). Which at times lead to issues where
the connection was never getting disconnected (after the initiator
closed it).

Removing and adding the fd, under epoll control (instead of modifying
the flags to be 0), and the issues go away.

Signed-off-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>
---
 usr/iscsi/iscsi_tcp.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: tgt-thread/usr/iscsi/iscsi_tcp.c
===================================================================
--- tgt-thread.orig/usr/iscsi/iscsi_tcp.c
+++ tgt-thread/usr/iscsi/iscsi_tcp.c
@@ -177,7 +177,8 @@ static void iscsi_tcp_event_handler(int 
 			pthread_mutex_unlock(&target->event_lock);
 			/* let the main thread handle this */
 			tcp_conn->pthread = 0;
-			tgt_event_modify(tcp_conn->fd, EPOLLIN|EPOLLOUT|EPOLLERR);
+			tgt_event_add(tcp_conn->fd, EPOLLIN,
+					iscsi_tcp_event_handler, conn);
 		} else {
 			conn_close(conn);
 		}
@@ -285,7 +286,7 @@ static void iscsi_tcp_conn_nexus_init(st
 
 	if (iscsi_pthread_per_target()) {
 		/* remove the conn from the main thread. */
-		conn->tp->ep_event_modify(conn, 0);
+		tgt_event_del(tcp_conn->fd);
 
 		tcp_conn->pthread = 1;
 


--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux