a3470f
From 3d845c38b0620547a58654a3b38ceed483b9779f Mon Sep 17 00:00:00 2001
a3470f
From: N Balachandran <nbalacha@redhat.com>
a3470f
Date: Wed, 14 Mar 2018 10:05:06 +0530
a3470f
Subject: [PATCH 221/236] cluster/dht:  Skipped files are not treated as errors
a3470f
a3470f
For skipped files, use a return value of 1 to prevent
a3470f
error messages being logged.
a3470f
upstream patch: https://review.gluster.org/#/c/19710/
a3470f
a3470f
> Change-Id: I18de31ac1a64d4460e88dea7826c3ba03c895861
a3470f
> BUG: 1553598
a3470f
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
a3470f
a3470f
Change-Id: I18de31ac1a64d4460e88dea7826c3ba03c895861
a3470f
BUG: 1546941
a3470f
Signed-off-by: N Balachandran <nbalacha@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/132609
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
a3470f
---
a3470f
 xlators/cluster/dht/src/dht-rebalance.c | 14 +++++++++-----
a3470f
 1 file changed, 9 insertions(+), 5 deletions(-)
a3470f
a3470f
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
a3470f
index a4be348..eee00b8 100644
a3470f
--- a/xlators/cluster/dht/src/dht-rebalance.c
a3470f
+++ b/xlators/cluster/dht/src/dht-rebalance.c
a3470f
@@ -594,7 +594,7 @@ __check_file_has_hardlink (xlator_t *this, loc_t *loc,
a3470f
                                 "Migration skipped for:"
a3470f
                                 "%s: file has hardlinks", loc->path);
a3470f
                         *fop_errno = ENOTSUP;
a3470f
-                        ret = -1;
a3470f
+                        ret = 1;
a3470f
                 }
a3470f
        }
a3470f
 
a3470f
@@ -649,7 +649,7 @@ __is_file_migratable (xlator_t *this, loc_t *loc,
a3470f
                                 "Migrate file failed: %s: File has locks."
a3470f
                                 " Skipping file migration", loc->path);
a3470f
                         *fop_errno = ENOTSUP;
a3470f
-                        ret = -1;
a3470f
+                        ret = 1;
a3470f
                         goto out;
a3470f
                 }
a3470f
         }
a3470f
@@ -964,7 +964,7 @@ __dht_check_free_space (xlator_t *this, xlator_t *to, xlator_t *from, loc_t *loc
a3470f
                         /* this is not a 'failure', but we don't want to
a3470f
                            consider this as 'success' too :-/ */
a3470f
                         *fop_errno = ENOSPC;
a3470f
-                        ret = -1;
a3470f
+                        ret = 1;
a3470f
                         goto out;
a3470f
                 }
a3470f
         }
a3470f
@@ -2719,7 +2719,7 @@ gf_defrag_migrate_single_file (void *opaque)
a3470f
 
a3470f
         ret = dht_migrate_file (this, &entry_loc, cached_subvol,
a3470f
                                 hashed_subvol, rebal_type, &fop_errno);
a3470f
-        if (ret < 0) {
a3470f
+        if (ret == 1) {
a3470f
                 if (fop_errno == ENOSPC) {
a3470f
                         gf_msg_debug (this->name, 0, "migrate-data skipped for"
a3470f
                                       " %s due to space constraints",
a3470f
@@ -2768,8 +2768,12 @@ gf_defrag_migrate_single_file (void *opaque)
a3470f
                                 DHT_MSG_MIGRATE_FILE_SKIPPED,
a3470f
                                 "File migration skipped for %s.",
a3470f
                                 entry_loc.path);
a3470f
+                }
a3470f
+
a3470f
+                ret = 0;
a3470f
 
a3470f
-                } else if (fop_errno != EEXIST) {
a3470f
+        } else if (ret < 0) {
a3470f
+                if (fop_errno != EEXIST) {
a3470f
                         gf_msg (this->name, GF_LOG_ERROR, fop_errno,
a3470f
                                 DHT_MSG_MIGRATE_FILE_FAILED,
a3470f
                                 "migrate-data failed for %s", entry_loc.path);
a3470f
-- 
a3470f
1.8.3.1
a3470f