summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrishna <krishna@gluster.com>2011-09-12 17:41:32 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-10 04:03:16 -0700
commit2cd86f11dda8bb377718b0d3e04924ee8f79cb59 (patch)
treee7f6f1e74260b5005e2141054cd27bb78f6fe7fc
parentbfd45840af03d07d11e467e497181dce3cec9df2 (diff)
nfs: size_t is an unsigned type. Changing it to ssize_t for "writelen" variable. Also propogate error to the calling functions.
Change-Id: If8ba73ac57bc235a28c1e1cdc7a5e11947e7a52f BUG: 3526 Reviewed-on: http://review.gluster.com/400 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shehjar Tikoo <shehjart@gluster.com>
-rw-r--r--xlators/nfs/lib/src/rpc-socket.c4
-rw-r--r--xlators/nfs/lib/src/rpcsvc.c24
2 files changed, 16 insertions, 12 deletions
diff --git a/xlators/nfs/lib/src/rpc-socket.c b/xlators/nfs/lib/src/rpc-socket.c
index 01380450ecc..62817be93d8 100644
--- a/xlators/nfs/lib/src/rpc-socket.c
+++ b/xlators/nfs/lib/src/rpc-socket.c
@@ -228,8 +228,8 @@ nfs_rpcsvc_socket_read (int sockfd, char *readaddr, size_t readsize)
ssize_t
nfs_rpcsvc_socket_write (int sockfd, char *buffer, size_t size, int *eagain)
{
- size_t writelen = -1;
- ssize_t written = 0;
+ ssize_t writelen = -1;
+ ssize_t written = 0;
if (!buffer)
return -1;
diff --git a/xlators/nfs/lib/src/rpcsvc.c b/xlators/nfs/lib/src/rpcsvc.c
index 179fd9b4d3c..5798aa66934 100644
--- a/xlators/nfs/lib/src/rpcsvc.c
+++ b/xlators/nfs/lib/src/rpcsvc.c
@@ -2638,30 +2638,33 @@ tx_remaining:
/* If we've broken out of the loop above then we must unblock
* the transmission now.
*/
- nfs_rpcsvc_socket_unblock_tx (conn->sockfd);
- if (list_empty (&conn->txbufs))
- conn->eventidx = event_select_on (conn->stage->eventpool,
- conn->sockfd, conn->eventidx,
- -1, 0);
-
- return 0;
+ if (written != -1) {
+ nfs_rpcsvc_socket_unblock_tx (conn->sockfd);
+ if (list_empty (&conn->txbufs))
+ conn->eventidx = event_select_on (conn->stage->eventpool,
+ conn->sockfd, conn->eventidx,
+ -1, 0);
+ return 0;
+ } else
+ return -1;
}
int
nfs_rpcsvc_conn_data_poll_out (rpcsvc_conn_t *conn)
{
+ int ret = -1;
if (!conn)
return -1;
pthread_mutex_lock (&conn->connlock);
{
- __nfs_rpcsvc_conn_data_poll_out (conn);
+ ret = __nfs_rpcsvc_conn_data_poll_out (conn);
}
pthread_mutex_unlock (&conn->connlock);
- return 0;
+ return ret;
}
@@ -2685,7 +2688,8 @@ nfs_rpcsvc_conn_data_handler (int fd, int idx, void *data, int poll_in,
return 0;
}
- if (poll_in) {
+ /* don't handle poll_in if we failed when we handled poll_out */
+ if ((ret != -1) && poll_in) {
ret = 0;
ret = nfs_rpcsvc_conn_data_poll_in (conn);
}