summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2018-06-13 12:17:28 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-06-25 13:43:51 +0000
commite60d337201854e391fe32ceb86c72a4cb7f23467 (patch)
treef842386f8ca7952479f9e885879746a6cff9b8d7 /xlators
parent6d19297f5bc09a6eb9d90aab5836fb099fe32783 (diff)
storage/posix: Handle ENOSPC correctly in zero_fill
Change-Id: Icc521d86cc510f88b67d334b346095713899087a BUG: 1591187 fixes: bz#1591187 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/storage/posix/src/posix.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index f4b760a53cb..69674504b19 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -917,17 +917,32 @@ _posix_do_zerofill(int fd, off_t offset, off_t len, int o_direct)
op_ret = sys_writev (fd, vector, num_vect);
if (op_ret < 0)
goto err;
+ if (op_ret != (vect_size * num_vect)) {
+ op_ret = -1;
+ errno = ENOSPC;
+ goto err;
+ }
}
if (extra) {
op_ret = sys_writev (fd, vector, extra);
if (op_ret < 0)
goto err;
+ if (op_ret != (vect_size * extra)) {
+ op_ret = -1;
+ errno = ENOSPC;
+ goto err;
+ }
}
if (remain) {
vector[0].iov_len = remain;
op_ret = sys_writev (fd, vector , 1);
if (op_ret < 0)
goto err;
+ if (op_ret != remain) {
+ op_ret = -1;
+ errno = ENOSPC;
+ goto err;
+ }
}
err:
if (o_direct)
@@ -988,8 +1003,14 @@ posix_do_zerofill (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
*/
flags = FALLOC_FL_ZERO_RANGE;
ret = sys_fallocate (pfd->fd, flags, offset, len);
- if (ret == 0)
+ if (ret == 0) {
goto fsync;
+ } else {
+ ret = -errno;
+ if ((ret != -ENOSYS) && (ret != -EOPNOTSUPP)) {
+ goto out;
+ }
+ }
ret = _posix_do_zerofill (pfd->fd, offset, len, pfd->flags & O_DIRECT);
if (ret < 0) {