summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/stripe
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2015-04-03 18:03:50 +0200
committerNiels de Vos <ndevos@redhat.com>2015-05-07 01:50:43 -0700
commit2bd2ccf0fdd5390c1c07cb228048f93e5e516512 (patch)
tree32a3ae732efd348e1bb3a8f24086c61a71e96aeb /xlators/cluster/stripe
parent98bd9830da7071eed71c95611da7ef8a5f1cf71e (diff)
stripe: set ENOENT when a READ hits EOF
The NFS-server sets EOF only in the READ reply when op_errno is set to ENOENT. Xlators are expected to set op_errno to ENOENT when EOF is reached, op_ret will contain the number of bytes returned by the READ. When an NFS-client (like VMware ESXi) do a READ that exceeds the size of the file, errno should be set to EOF and the return value contains the number of bytes that are read (from the requested offset, until the end of the file). Not setting EOF on a correct short READ, can result in errors on the NFS-client. This is not an issue with the Linux NFS-client (or VFS). Linux is smart enough to not try to read more bytes than the file contains. BUG: 1209298 Change-Id: Ib15538744908a6001d729288d3e18a432d19050b Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10142 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Diffstat (limited to 'xlators/cluster/stripe')
-rw-r--r--xlators/cluster/stripe/src/stripe.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index 7ac131b2ca9..71d9230f708 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -3256,6 +3256,11 @@ stripe_readv_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
GF_FREE (local->replies[i].vector);
}
+ /* ENOENT signals EOF to the NFS-server */
+ if (op_ret != -1 && op_ret < local->readv_size &&
+ (local->offset + op_ret == buf->ia_size))
+ op_errno = ENOENT;
+
/* FIXME: notice that st_ino, and st_dev (gen) will be
* different than what inode will have. Make sure this doesn't
* cause any bugs at higher levels */