From 0284bd630baa376b00d334d6339272c896960473 Mon Sep 17 00:00:00 2001 From: hari gowtham Date: Thu, 2 Nov 2017 18:13:17 +0530 Subject: tier: coverity fix for tier-common.c fix for the coverity id: 258, 162 Change-Id: I35ba21e37e186b7c1ce54faf5b24f48858e6fc70 BUG: 789278 Signed-off-by: hari gowtham --- xlators/cluster/dht/src/tier-common.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/dht/src/tier-common.c b/xlators/cluster/dht/src/tier-common.c index b2abda73265..2f30ef67fe4 100644 --- a/xlators/cluster/dht/src/tier-common.c +++ b/xlators/cluster/dht/src/tier-common.c @@ -235,8 +235,10 @@ tier_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_linkfile_attr_heal (frame, this); } out: - if (local->xattr_req) { - dict_del (local->xattr_req, TIER_LINKFILE_GFID); + if (local) { + if (local->xattr_req) { + dict_del (local->xattr_req, TIER_LINKFILE_GFID); + } } DHT_STRIP_PHASE1_FLAGS (stbuf); @@ -766,25 +768,17 @@ tier_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, gf_dirent_t *orig_entries, dict_t *xdata) { - dht_local_t *local = NULL; gf_dirent_t entries; gf_dirent_t *orig_entry = NULL; gf_dirent_t *entry = NULL; - xlator_t *prev = NULL; - xlator_t *next_subvol = NULL; - off_t next_offset = 0; int count = 0; INIT_LIST_HEAD (&entries.list); - prev = cookie; - local = frame->local; if (op_ret < 0) - goto done; + goto unwind; list_for_each_entry (orig_entry, (&orig_entries->list), list) { - next_offset = orig_entry->d_off; - entry = gf_dirent_for_name (orig_entry->d_name); if (!entry) { gf_msg (this->name, GF_LOG_ERROR, ENOMEM, @@ -803,23 +797,6 @@ tier_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } op_ret = count; -done: - if (count == 0) { - /* non-zero next_offset means that - EOF is not yet hit on the current subvol - */ - if (next_offset != 0) { - next_subvol = prev; - } else { - goto unwind; - } - - STACK_WIND_COOKIE (frame, tier_readdir_cbk, next_subvol, - next_subvol, next_subvol->fops->readdir, - local->fd, local->size, next_offset, NULL); - return 0; - } - unwind: if (op_ret < 0) op_ret = 0; -- cgit