diff options
author | Rinku Kothiya <rkothiya@redhat.com> | 2020-09-24 12:43:51 +0000 |
---|---|---|
committer | Xavi Hernandez <xhernandez@users.noreply.github.com> | 2020-11-03 09:48:06 +0100 |
commit | 7ccb1f1878c864e9e06547cad883bf12a90147b3 (patch) | |
tree | 8ddad5596f55488f80ad83966151a44675e3dc98 | |
parent | 8c0a1047c16dc9e80bc094cd0a825511252d7035 (diff) | |
download | glusterfs-7ccb1f1878c864e9e06547cad883bf12a90147b3.tar.gz glusterfs-7ccb1f1878c864e9e06547cad883bf12a90147b3.tar.xz glusterfs-7ccb1f1878c864e9e06547cad883bf12a90147b3.zip |
gfapi: give appropriate error when size exceeds
This patch help generate appropriate error message
when the gfapi tries to write data equal to or
greater than 1 Gb due to the limitation at the
socket layer.
fixes: #1518
Change-Id: I1234a0b5a6e675a0b20c6b1afe0f4390fd721f6f
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
-rw-r--r-- | api/src/glfs-fops.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 6aa3c5602d..7eeabd691b 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -1534,6 +1534,14 @@ glfs_pwritev_common(struct glfs_fd *glfd, const struct iovec *iovec, int iovcnt, GF_REF_GET(glfd); + if (iovec->iov_len >= GF_UNIT_GB) { + ret = -1; + errno = EINVAL; + gf_smsg(THIS->name, GF_LOG_ERROR, errno, API_MSG_INVALID_ARG, + "size >= %llu is not allowed", GF_UNIT_GB, NULL); + goto out; + } + subvol = glfs_active_subvol(glfd->fs); if (!subvol) { ret = -1; |