diff options
author | Dan Lambright <dlambrig@redhat.com> | 2015-08-02 15:17:30 +0100 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-09-02 04:55:07 -0700 |
commit | 092cc95ddc7af7d99bb362e790cf52c296c25bb8 (patch) | |
tree | bfe179dc215b1a445eeb0bf5417ef73ab116a4a2 /xlators/cluster/dht | |
parent | c42a888fe9d69bf942f2e65bf982d848098978b6 (diff) |
cluster/tier: avoid filling /var/run with tiering files
We failed to delete old promote/demote workfiles in /var/run.
This fix removes the <pid> postfix so there will be only a
single pair of files.
Change-Id: Ib9aafe7b4a9d4b0c05cf03a94cc1057a423a27d2
BUG: 1253970
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/11931
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index d47932df5c0..7563ec7f20b 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -1104,6 +1104,7 @@ tier_init (xlator_t *this) int freq = 0; dht_conf_t *conf = NULL; gf_defrag_info_t *defrag = NULL; + char *voldir = NULL; ret = dht_init(this); if (ret) { @@ -1173,22 +1174,45 @@ tier_init (xlator_t *this) defrag->read_freq_threshold = freq; - ret = gf_asprintf(&promotion_qfile, "%s/%s-%d", + ret = gf_asprintf(&voldir, "%s/%s", DEFAULT_VAR_RUN_DIRECTORY, + this->name); + if (ret < 0) + goto out; + + ret = mkdir_p(voldir, 0777, _gf_true); + if (ret == -1 && errno != EEXIST) { + gf_msg(this->name, GF_LOG_ERROR, 0, + DHT_MSG_LOG_TIER_ERROR, + "tier_init failed"); + + GF_FREE(voldir); + goto out; + } + + GF_FREE(voldir); + + ret = gf_asprintf(&promotion_qfile, "%s/%s/%s-%s", + DEFAULT_VAR_RUN_DIRECTORY, + this->name, PROMOTION_QFILE, - getpid()); + this->name); if (ret < 0) goto out; - ret = gf_asprintf(&demotion_qfile, "%s/%s-%d", + ret = gf_asprintf(&demotion_qfile, "%s/%s/%s-%s", DEFAULT_VAR_RUN_DIRECTORY, + this->name, DEMOTION_QFILE, - getpid()); + this->name); if (ret < 0) { GF_FREE(promotion_qfile); goto out; } + unlink(promotion_qfile); + unlink(demotion_qfile); + gf_msg(this->name, GF_LOG_INFO, 0, DHT_MSG_LOG_TIER_STATUS, "Promote/demote frequency %d/%d " |