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