[Stgt-devel] [PATCH] iscsi no spin with async bs

Pete Wyckoff pw
Mon Jul 30 19:31:44 CEST 2007


A missing call to tgt_event_modify(fd, EPOLLIN) is added.  Without this, an
asynchronous backing store would cause tgtd to spin in epoll, always
reporting EPOLLOUT on the socket but having nothing to write.  When the
thread completes the command, the bs will cause cmd_done, turning EPOLLOUT
back on.

No change for synchronous backing stores, as epoll does not get called
until the command completes.

It would also spin briefly waiting for the rest of the unsolicited packets,
in both sync and async cases.

Signed-off-by: Pete Wyckoff <pw at osc.edu>
---
 usr/iscsi/iscsid.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index ae840ad..e092462 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -1145,16 +1145,16 @@ static int iscsi_scsi_cmd_execute(struct iscsi_task *task)
 	int err = 0;
 
 	if (rw && task->r2t_count) {
-		if (!task->unsol_count)
+		if (!task->unsol_count) {
 			list_add_tail(&task->c_list, &task->conn->tx_clist);
-		goto no_queuing;
+			tgt_event_modify(conn->fd, EPOLLIN | EPOLLOUT);
+		}
+		return err;
 	}
 
 	task->offset = 0;  /* for use as transmit pointer for data-ins */
+	tgt_event_modify(conn->fd, EPOLLIN);
 	err = iscsi_target_cmd_queue(task);
-no_queuing:
-	tgt_event_modify(conn->fd, EPOLLIN|EPOLLOUT);
-
 	return err;
 }
 
-- 
1.5.2.4




More information about the stgt mailing list