|
|
e3c68b |
From 5b1bfebacac649e6f5051316e4075309caf93901 Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Barak Sason Rofman <bsasonro@redhat.com>
|
|
|
e3c68b |
Date: Tue, 21 Apr 2020 19:13:41 +0300
|
|
|
e3c68b |
Subject: [PATCH 364/367] dht - fixing rebalance failures for files with holes
|
|
|
e3c68b |
|
|
|
e3c68b |
Rebalance process handling of files which contains holes casued
|
|
|
e3c68b |
rebalance to fail with "No space left on device" errors.
|
|
|
e3c68b |
This patch modifies the code-flow in such a way that files with holes
|
|
|
e3c68b |
will be rebalanced correctly.
|
|
|
e3c68b |
|
|
|
e3c68b |
backport of https://review.gluster.org/#/c/glusterfs/+/24357/
|
|
|
e3c68b |
>fixes: #1187
|
|
|
e3c68b |
>Change-Id: I89bc3d4ea7f074db7213d759c49307f379543932
|
|
|
e3c68b |
>Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
|
|
|
e3c68b |
|
|
|
e3c68b |
BUG: 1823703
|
|
|
e3c68b |
Change-Id: I89bc3d4ea7f074db7213d759c49307f379543932
|
|
|
e3c68b |
Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/198579
|
|
|
e3c68b |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e3c68b |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
xlators/cluster/dht/src/dht-rebalance.c | 21 ++++++++++-----------
|
|
|
e3c68b |
1 file changed, 10 insertions(+), 11 deletions(-)
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
e3c68b |
index f4c62b8..7d9df02 100644
|
|
|
e3c68b |
--- a/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
e3c68b |
+++ b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
e3c68b |
@@ -650,7 +650,7 @@ out:
|
|
|
e3c68b |
static int
|
|
|
e3c68b |
__dht_rebalance_create_dst_file(xlator_t *this, xlator_t *to, xlator_t *from,
|
|
|
e3c68b |
loc_t *loc, struct iatt *stbuf, fd_t **dst_fd,
|
|
|
e3c68b |
- int *fop_errno)
|
|
|
e3c68b |
+ int *fop_errno, int file_has_holes)
|
|
|
e3c68b |
{
|
|
|
e3c68b |
int ret = -1;
|
|
|
e3c68b |
int ret2 = -1;
|
|
|
e3c68b |
@@ -819,7 +819,7 @@ __dht_rebalance_create_dst_file(xlator_t *this, xlator_t *to, xlator_t *from,
|
|
|
e3c68b |
|
|
|
e3c68b |
/* No need to bother about 0 byte size files */
|
|
|
e3c68b |
if (stbuf->ia_size > 0) {
|
|
|
e3c68b |
- if (conf->use_fallocate) {
|
|
|
e3c68b |
+ if (conf->use_fallocate && !file_has_holes) {
|
|
|
e3c68b |
ret = syncop_fallocate(to, fd, 0, 0, stbuf->ia_size, NULL, NULL);
|
|
|
e3c68b |
if (ret < 0) {
|
|
|
e3c68b |
if (ret == -EOPNOTSUPP || ret == -EINVAL || ret == -ENOSYS) {
|
|
|
e3c68b |
@@ -846,9 +846,7 @@ __dht_rebalance_create_dst_file(xlator_t *this, xlator_t *to, xlator_t *from,
|
|
|
e3c68b |
goto out;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
}
|
|
|
e3c68b |
- }
|
|
|
e3c68b |
-
|
|
|
e3c68b |
- if (!conf->use_fallocate) {
|
|
|
e3c68b |
+ } else {
|
|
|
e3c68b |
ret = syncop_ftruncate(to, fd, stbuf->ia_size, NULL, NULL, NULL,
|
|
|
e3c68b |
NULL);
|
|
|
e3c68b |
if (ret < 0) {
|
|
|
e3c68b |
@@ -1728,9 +1726,13 @@ dht_migrate_file(xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
|
|
|
e3c68b |
goto out;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
+ /* Try to preserve 'holes' while migrating data */
|
|
|
e3c68b |
+ if (stbuf.ia_size > (stbuf.ia_blocks * GF_DISK_SECTOR_SIZE))
|
|
|
e3c68b |
+ file_has_holes = 1;
|
|
|
e3c68b |
+
|
|
|
e3c68b |
/* create the destination, with required modes/xattr */
|
|
|
e3c68b |
ret = __dht_rebalance_create_dst_file(this, to, from, loc, &stbuf, &dst_fd,
|
|
|
e3c68b |
- fop_errno);
|
|
|
e3c68b |
+ fop_errno, file_has_holes);
|
|
|
e3c68b |
if (ret) {
|
|
|
e3c68b |
gf_msg(this->name, GF_LOG_ERROR, 0, 0,
|
|
|
e3c68b |
"Create dst failed"
|
|
|
e3c68b |
@@ -1774,8 +1776,8 @@ dht_migrate_file(xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
|
|
|
e3c68b |
* destination. We need to do update this only post migration
|
|
|
e3c68b |
* as in case of failure the linkto needs to point to the source
|
|
|
e3c68b |
* subvol */
|
|
|
e3c68b |
- ret = __dht_rebalance_create_dst_file(this, to, from, loc, &stbuf,
|
|
|
e3c68b |
- &dst_fd, fop_errno);
|
|
|
e3c68b |
+ ret = __dht_rebalance_create_dst_file(
|
|
|
e3c68b |
+ this, to, from, loc, &stbuf, &dst_fd, fop_errno, file_has_holes);
|
|
|
e3c68b |
if (ret) {
|
|
|
e3c68b |
gf_log(this->name, GF_LOG_ERROR,
|
|
|
e3c68b |
"Create dst failed"
|
|
|
e3c68b |
@@ -1862,9 +1864,6 @@ dht_migrate_file(xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
|
|
|
e3c68b |
ret = 0;
|
|
|
e3c68b |
goto out;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
- /* Try to preserve 'holes' while migrating data */
|
|
|
e3c68b |
- if (stbuf.ia_size > (stbuf.ia_blocks * GF_DISK_SECTOR_SIZE))
|
|
|
e3c68b |
- file_has_holes = 1;
|
|
|
e3c68b |
|
|
|
e3c68b |
ret = __dht_rebalance_migrate_data(this, defrag, from, to, src_fd, dst_fd,
|
|
|
e3c68b |
stbuf.ia_size, file_has_holes,
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|