summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/lib/src/rpcsvc.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2011-03-15 01:57:13 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-31 04:19:27 -0700
commita54e0358b1d66c04448b22c1a01e076b5a527008 (patch)
tree1393f0ea4b441752cc647cc3a8e677746fb41597 /xlators/nfs/lib/src/rpcsvc.c
parent325ee7aeab629a7435922d9e61d04fd3418ec6d7 (diff)
nfs-rpc: Exit txbuf transmission loop on EAGAIN
..instead of looping till the buffer is completely transmitted. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2491 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2491
Diffstat (limited to 'xlators/nfs/lib/src/rpcsvc.c')
-rw-r--r--xlators/nfs/lib/src/rpcsvc.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/xlators/nfs/lib/src/rpcsvc.c b/xlators/nfs/lib/src/rpcsvc.c
index 363b94fbe..3f6e3b9f0 100644
--- a/xlators/nfs/lib/src/rpcsvc.c
+++ b/xlators/nfs/lib/src/rpcsvc.c
@@ -2555,6 +2555,7 @@ __nfs_rpcsvc_conn_data_poll_out (rpcsvc_conn_t *conn)
ssize_t written = -1;
char *writeaddr = NULL;
size_t writesize = -1;
+ int eagain = 0;
if (!conn)
return -1;
@@ -2562,6 +2563,7 @@ __nfs_rpcsvc_conn_data_poll_out (rpcsvc_conn_t *conn)
/* Attempt transmission of each of the pending buffers */
list_for_each_entry_safe (txbuf, tmp, &conn->txbufs, txlist) {
tx_remaining:
+ eagain = 0;
writeaddr = (char *)(txbuf->buf.iov_base + txbuf->offset);
writesize = (txbuf->buf.iov_len - txbuf->offset);
@@ -2571,7 +2573,7 @@ tx_remaining:
}
written = nfs_rpcsvc_socket_write (conn->sockfd, writeaddr,
- writesize);
+ writesize, &eagain);
if (txbuf->txbehave & RPCSVC_TXB_LAST) {
gf_log (GF_RPCSVC, GF_LOG_TRACE, "Last Tx Buf");
nfs_rpcsvc_socket_unblock_tx (conn->sockfd);
@@ -2600,12 +2602,21 @@ tx_remaining:
list_del (&txbuf->txlist);
mem_put (conn->txpool, txbuf);
- } else
+ } else {
/* If the current buffer is incompletely tx'd, do not
* go to the head of the loop, since that moves us to
* the next buffer.
+ *
+ * BUT, if the current transmission exited due to EAGAIN
+ * we need to leave the buffers where they are and come
+ * back later for retransmission.
*/
- goto tx_remaining;
+ if (!eagain)
+ goto tx_remaining;
+ else
+ break;
+ }
+
}
/* If we've broken out of the loop above then we must unblock