From 7f001813bc04ede65b05d588f16e0a6c68a94cfe Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Mon, 18 May 2009 08:19:10 +0000 Subject: 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 --- xlators/features/locks/src/posix.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'xlators/features/locks') 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; } -- cgit