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