14f8ab
From 63ea2aad2474a0ca169342c699cb1689e6c1d83f Mon Sep 17 00:00:00 2001
14f8ab
From: Susant Palai <spalai@redhat.com>
14f8ab
Date: Fri, 22 May 2020 13:49:14 +0530
14f8ab
Subject: [PATCH 381/382] dht: add null check in gf_defrag_free_dir_dfmeta
14f8ab
14f8ab
Backport of https://review.gluster.org/#/c/glusterfs/+/24479/
14f8ab
14f8ab
BUG:1812789
14f8ab
Change-Id: I502ed43051bd60d9e5d2b69d4e4d7b6eea997285
14f8ab
Signed-off-by: Susant Palai <spalai@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/201150
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Ashish Pandey <aspandey@redhat.com>
14f8ab
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
14f8ab
---
14f8ab
 xlators/cluster/dht/src/dht-rebalance.c | 9 +++++----
14f8ab
 1 file changed, 5 insertions(+), 4 deletions(-)
14f8ab
14f8ab
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
14f8ab
index 957deaa..8f31dca 100644
14f8ab
--- a/xlators/cluster/dht/src/dht-rebalance.c
14f8ab
+++ b/xlators/cluster/dht/src/dht-rebalance.c
14f8ab
@@ -47,7 +47,8 @@ gf_defrag_free_dir_dfmeta(struct dir_dfmeta *meta, int local_subvols_cnt)
14f8ab
 
14f8ab
     if (meta) {
14f8ab
         for (i = 0; i < local_subvols_cnt; i++) {
14f8ab
-            gf_dirent_free(&meta->equeue[i]);
14f8ab
+            if (meta->equeue)
14f8ab
+                gf_dirent_free(&meta->equeue[i]);
14f8ab
             if (meta->lfd && meta->lfd[i])
14f8ab
                 fd_unref(meta->lfd[i]);
14f8ab
         }
14f8ab
@@ -3344,9 +3345,9 @@ gf_defrag_process_dir(xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
14f8ab
         if (ret) {
14f8ab
             fd_unref(dir_dfmeta->lfd[i]);
14f8ab
             dir_dfmeta->lfd[i] = NULL;
14f8ab
-            gf_smsg(this->name, GF_LOG_WARNING, 0, 0,
14f8ab
-                    "failed to open dir: %s subvol: %s", loc->path,
14f8ab
-                    conf->local_subvols[i]->name);
14f8ab
+            gf_msg(this->name, GF_LOG_WARNING, -ret, 0,
14f8ab
+                   "failed to open dir: %s subvol: %s", loc->path,
14f8ab
+                   conf->local_subvols[i]->name);
14f8ab
 
14f8ab
             if (conf->decommission_in_progress) {
14f8ab
                 *perrno = -ret;
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab