From 13dbf333c47f0bc0efffddd4b8b83c4031cb7f36 Mon Sep 17 00:00:00 2001 From: Dan Lambright Date: Wed, 25 Mar 2015 14:25:33 -0400 Subject: cluster/dht: Fix coverity bug in tiering code The bug was: *** CID 1291734: Error handling issues (CHECKED_RETURN) /xlators/cluster/dht/src/tier.c: 451 in tier_build_migration_qfile() The fix is to check the return code to the remove library call. It is legal to fail, we just log an INFO level message. Change-Id: I026eb49276b394efa3b8092ee2cc209c470aacb2 BUG: 1194753 Signed-off-by: Dan Lambright Reviewed-on: http://review.gluster.org/10000 Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- xlators/cluster/dht/src/tier.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index 028a42f7a1a..7e3eaa02c02 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -448,10 +448,25 @@ tier_build_migration_qfile (demotion_args_t *args, gfdb_time_t time_in_past; int ret = -1; - remove (GET_QFILE_PATH (is_promotion)); + /* + * The first time this function is called, query file will + * not exist on a given instance of running the migration daemon. + * The remove call is optimistic and it is legal if it fails. + */ + + ret = remove (GET_QFILE_PATH (is_promotion)); + if (ret == -1) { + gf_msg (args->this->name, GF_LOG_INFO, 0, + DHT_MSG_LOG_TIER_STATUS, + "Failed to remove %s", + GET_QFILE_PATH (is_promotion)); + } + time_in_past.tv_sec = args->freq_time; time_in_past.tv_usec = 0; - if (gettimeofday (¤t_time, NULL) == -1) { + + ret = gettimeofday (¤t_time, NULL); + if (ret == -1) { gf_log (args->this->name, GF_LOG_ERROR, "Failed to get current timen"); goto out; -- cgit