diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2019-04-26 08:47:12 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-04-26 13:15:36 +0000 |
commit | 13e1fe6dbd39ef88cadce1590b5d4c45b67387cb (patch) | |
tree | 23e3cf1e4bfe2bacdd2fb15d597eb4c839adda65 /xlators/mgmt/glusterd | |
parent | 146e4b45d0ce906ae50fd6941a1efafd133897ea (diff) |
glusterd: coverity fixes
1400775 - USE_AFTER_FREE
1400742 - Missing Unlock
1400736 - CHECKED_RETURN
1398470 - Missing Unlock
Missing unlock is the tricky one, we have had annotation added, but
coverity still continued to complaint. Added pthread_mutex_unlock to
clean up the lock before destroying it to see if it makes coverity
happy.
Updates: bz#789278
Change-Id: I1d892612a17f805144d96c1b15004a85a1639414
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 5 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-peer-utils.c | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-sm.c | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 8 |
5 files changed, 9 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 4b069574bbd..aabfe3f3df5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -3288,11 +3288,6 @@ glusterd_friend_remove(uuid_t uuid, char *hostname) ret = glusterd_peerinfo_cleanup(peerinfo); out: gf_msg_debug(THIS->name, 0, "returning %d", ret); - /* We don't need to do a mutex unlock of peerinfo->delete_lock as the same - * will be anyway destroyed within glusterd_peerinfo_cleanup, coverity - * though cries about it - */ - /* coverity[LOCK] */ return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c index 5b5959ee721..7097439b9ff 100644 --- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c @@ -48,6 +48,7 @@ glusterd_peerinfo_destroy(struct rcu_head *head) } glusterd_sm_tr_log_delete(&peerinfo->sm_log); + pthread_mutex_unlock(&peerinfo->delete_lock); pthread_mutex_destroy(&peerinfo->delete_lock); GF_FREE(peerinfo); diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c index 3e257e63c18..2edc2738954 100644 --- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c @@ -460,8 +460,8 @@ glusterd_shdsvc_start(glusterd_svc_t *svc, int flags) "Failed to attach shd svc(volume=%s) to pid=%d. Starting" "a new process", volinfo->volname, glusterd_proc_get_pid(&svc->proc)); - glusterd_volinfo_unref(volinfo); ret = glusterd_recover_shd_attach_failure(volinfo, svc, flags); + glusterd_volinfo_unref(volinfo); } goto out; } diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c index f0fcd956d30..6f916b634c1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-sm.c @@ -878,7 +878,6 @@ glusterd_ac_friend_remove(glusterd_friend_sm_event_t *event, void *ctx) "Cleanup returned: %d", ret); } out: - /* coverity[ LOCK] */ return 0; } diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 626c9913d7a..4f0eb32ff48 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -5617,7 +5617,13 @@ attach_brick_callback(struct rpc_req *req, struct iovec *iov, int count, /* PID file is copied once brick has attached successfully */ - glusterd_copy_file(pidfile1, pidfile2); + ret = glusterd_copy_file(pidfile1, pidfile2); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY, + "Could not copy file %s to %s", pidfile1, pidfile2); + goto out; + } + brickinfo->status = GF_BRICK_STARTED; brickinfo->rpc = rpc_clnt_ref(other_brick->rpc); gf_log(THIS->name, GF_LOG_INFO, "brick %s is attached successfully", |