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