diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2018-06-13 12:17:28 +0530 |
---|---|---|
committer | jiffin tony Thottan <jthottan@redhat.com> | 2018-06-14 05:44:30 +0000 |
commit | 6ef91480f9e75f63100585bfd19694deb0c2457b (patch) | |
tree | 899d90d7c50fcd3a9391f1383751dfaf0b3c023b /xlators/storage | |
parent | 87f392e7fa22c059a95ff58f1653a285afc0f27a (diff) |
storage/posix: Handle ENOSPC correctly in zero_fill
Change-Id: Icc521d86cc510f88b67d334b346095713899087a
fixes: bz#1590710
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/storage')
-rw-r--r-- | xlators/storage/posix/src/posix-inode-fd-ops.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c index 08916c6d89f..714be7f7234 100644 --- a/xlators/storage/posix/src/posix-inode-fd-ops.c +++ b/xlators/storage/posix/src/posix-inode-fd-ops.c @@ -795,17 +795,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) @@ -877,8 +892,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) { |