summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-02-25 15:37:47 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-03-04 03:12:18 -0800
commit9fe5c6d391fd159fe27022ab806408831ed5b27f (patch)
tree7957c6a54d4e7d6e9f0ba6ab0d5cb2f2aa353c96 /xlators/storage/posix
parent1262b1e4fe3fcdfe3f8d6e3c29f41de68cfe8fa3 (diff)
posix: Support EOF for file reading
This is a small hack to notify higher translators that an end-of-file was encountered at the end of the readv operation. This is helpful in determining end-of-file without sending another readv fop. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 597 (miscellaneous fixes for xlators to work well with NFS xlator) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=597
Diffstat (limited to 'xlators/storage/posix')
-rw-r--r--xlators/storage/posix/src/posix.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index dcff1dbe2..f1541a2da 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -2530,7 +2530,13 @@ posix_readv (call_frame_t *frame, xlator_t *this,
goto out;
}
- op_ret = vec.iov_len;
+ /* Hack to notify higher layers of EOF. */
+ if (stbuf.st_size == 0)
+ op_errno = ENOENT;
+ else if ((offset + vec.iov_len) == stbuf.st_size)
+ op_errno = ENOENT;
+
+ op_ret = vec.iov_len;
out:
STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno,