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>
This commit is contained in:
Vikas Gorur 2009-05-18 08:19:10 +00:00 committed by Anand V. Avati
parent a9d0be4f1b
commit 7f001813bc

View File

@ -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;
}