diff options
| author | Pavan T C <tcp@gluster.com> | 2011-02-23 06:23:26 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2011-03-03 18:26:41 -0800 | 
| commit | 689c1b5044e701e1b695a6e6c80647b9471ba454 (patch) | |
| tree | 05ab691c76496ae45438e647bd52bf12b8931484 /xlators/nfs/lib/src | |
| parent | 826bf14de9eafe1cb67c45f25a9cfb236649801a (diff) | |
Eliminate syscall tight loop when handling EAGAIN in NFS.
Signed-off-by: Pavan T C <tcp@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 2452 (Excessive CPU usage /very low throughput while using NFS mounts)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2452
Diffstat (limited to 'xlators/nfs/lib/src')
| -rw-r--r-- | xlators/nfs/lib/src/rpcsvc.c | 15 | 
1 files changed, 14 insertions, 1 deletions
diff --git a/xlators/nfs/lib/src/rpcsvc.c b/xlators/nfs/lib/src/rpcsvc.c index 515e8738fc9..84ee7bc2234 100644 --- a/xlators/nfs/lib/src/rpcsvc.c +++ b/xlators/nfs/lib/src/rpcsvc.c @@ -2557,6 +2557,7 @@ tx_remaining:                          nfs_rpcsvc_socket_block_tx (conn->sockfd);                  } +                errno = 0;                  written = nfs_rpcsvc_socket_write (conn->sockfd, writeaddr,                                                     writesize);                  if (txbuf->txbehave & RPCSVC_TXB_LAST) { @@ -2566,13 +2567,25 @@ tx_remaining:                  gf_log (GF_RPCSVC, GF_LOG_TRACE, "conn: 0x%lx, Tx request: %zu,"                          " Tx sent: %zd", (long)conn, writesize, written); -                /* There was an error transmitting this buffer */ +                /* +                 * There was an error transmitting this buffer. We are polling +                 * for errors. So, there is no necessity to handle closure of +                 * the connection explicitly here. +                 */                  if (written == -1)                          break;                  if (written >= 0)                          txbuf->offset += written; +                if (errno == EAGAIN) { +                        /* +                         * Socket layer is indicating flow-control. We +                         * break-out now and wait for the next event indicating +                         * room for writes. +                         */ +                        break; +                }                  /* If the current buffer has been completely transmitted,                   * delete it from the list and move on to the next buffer.                   */  | 
