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