3604df
From 9c51c42139523892939e375cfdd0496ff700624b Mon Sep 17 00:00:00 2001
3604df
From: Pranith Kumar K <pkarampu@redhat.com>
3604df
Date: Fri, 30 Sep 2016 17:16:43 +0530
3604df
Subject: [PATCH 105/141] cluster/afr: Prevent dict_set() on NULL dict
3604df
3604df
In afr lookup when NULL dict is received in lookup, afr
3604df
is supposed to set all the xattrs it requires in a new dict
3604df
it creates, but for 'link-count' it is trying to set to the
3604df
dict that is passed in lookup which can be NULL sometimes.
3604df
This is leading to error logs. Fixed the same in this patch.
3604df
3604df
 >BUG: 1385104
3604df
 >Change-Id: I679af89cfc410cbc35557ae0691763a05eb5ed0e
3604df
 >Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
3604df
 >Reviewed-on: http://review.gluster.org/15646
3604df
 >Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
 >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
 >CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
 >Reviewed-by: Ravishankar N <ravishankar@redhat.com>
3604df
3604df
BUG: 1380710
3604df
Change-Id: I802e74e7ad24e183b6653101ad7bf5ab0bf6e55b
3604df
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/87208
3604df
---
3604df
 xlators/cluster/afr/src/afr-common.c |    3 ++-
3604df
 1 files changed, 2 insertions(+), 1 deletions(-)
3604df
3604df
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
3604df
index 97d6f2f..a743446 100644
3604df
--- a/xlators/cluster/afr/src/afr-common.c
3604df
+++ b/xlators/cluster/afr/src/afr-common.c
3604df
@@ -1327,7 +1327,8 @@ afr_lookup_xattr_req_prepare (afr_local_t *local, xlator_t *this,
3604df
                         loc->path, GLUSTERFS_PARENT_ENTRYLK);
3604df
         }
3604df
 
3604df
-        ret = dict_set_str (xattr_req, "link-count", GF_XATTROP_INDEX_COUNT);
3604df
+        ret = dict_set_str (local->xattr_req, "link-count",
3604df
+                            GF_XATTROP_INDEX_COUNT);
3604df
         if (ret) {
3604df
                 gf_msg_debug (this->name, -ret,
3604df
                               "Unable to set link-count in dict ");
3604df
-- 
3604df
1.7.1
3604df