summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-05-18 08:19:10 +0000
committerAnand V. Avati <avati@amp.gluster.com>2009-05-19 21:20:31 +0530
commit7f001813bc04ede65b05d588f16e0a6c68a94cfe (patch)
tree0aecce8f45248955aeaa85dcaa3e06bc1d791043
parenta9d0be4f1b78d9c03e9379fc5cea0ead6114c1d0 (diff)
Change errno to EAGAIN in readv/writev
When mandatory locks are enabled and a read/write would block due to a lock and if the fd is opened with O_NONBLOCK, return EAGAIN (previously EWOULDBLOCK). Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r--xlators/features/locks/src/posix.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index cffdbbb1f..144c8fedf 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -464,9 +464,9 @@ pl_readv (call_frame_t *frame, xlator_t *this,
}
if (fd->flags & O_NONBLOCK) {
- gf_log (this->name, GF_LOG_DEBUG,
- "returning EWOULDBLOCK");
- op_errno = EWOULDBLOCK;
+ gf_log (this->name, GF_LOG_TRACE,
+ "returning EAGAIN as fd is O_NONBLOCK");
+ op_errno = EAGAIN;
op_ret = -1;
goto unlock;
}
@@ -557,9 +557,10 @@ pl_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
goto unlock;
if (fd->flags & O_NONBLOCK) {
- gf_log (this->name, GF_LOG_DEBUG,
- "returning EWOULDBLOCK");
- op_errno = EWOULDBLOCK;
+ gf_log (this->name, GF_LOG_TRACE,
+ "returning EAGAIN because fd is "
+ "O_NONBLOCK");
+ op_errno = EAGAIN;
op_ret = -1;
goto unlock;
}