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