diff options
author | Dan Lambright <dlambrig@redhat.com> | 2015-03-25 14:25:33 -0400 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2015-04-04 10:37:55 -0700 |
commit | 13dbf333c47f0bc0efffddd4b8b83c4031cb7f36 (patch) | |
tree | 8b778fd8328081c9cd648388f19a520a0e90c058 /xlators | |
parent | 5599165e09e5c5e2862996b5f92cf1a1227b9039 (diff) |
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 <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/10000
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 19 |
1 files changed, 17 insertions, 2 deletions
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; |