[Stgt-devel] [PATCH] stgt: avoid confusing debug message

Pete Wyckoff pw
Fri Jan 19 16:54:08 CET 2007


Do not print errno in debug message when read returns 0.  Rewrote
the logic a bit too so it is easier to follow.

Signed-off-by: Pete Wyckoff <pw at osc.edu>
---

Index: usr/iscsi/iscsid.c
===================================================================
--- usr/iscsi/iscsid.c	(revision 766)
+++ usr/iscsi/iscsid.c	(working copy)
@@ -1520,12 +1520,18 @@ static void iscsi_rx_handler(int fd, str
 	case IOSTATE_READ_AHS_DATA:
 	read_again:
 		res = conn->tp->ep_read(fd, conn->rx_buffer, conn->rx_size);
-		if (res <= 0) {
-			if (res == 0 || (errno != EINTR && errno != EAGAIN)) {
+		if (res == 0) {
+			conn->state = STATE_CLOSE;
+			break;
+		} else if (res < 0) {
+			if (errno == EINTR)
+				goto read_again;
+			else if (errno == EAGAIN)
+				break;
+			else {
 				conn->state = STATE_CLOSE;
 				dprintf("%d %d, %m\n", res, errno);
-			} else if (errno == EINTR)
-				goto read_again;
+			}
 			break;
 		}
 		conn->rx_size -= res;



More information about the stgt mailing list