summaryrefslogtreecommitdiffstats
path: root/xlators/features/changelog
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2014-11-10 12:41:49 +0530
committerVenky Shankar <vshankar@redhat.com>2015-01-18 04:30:42 -0800
commitdec4700c663975896f3aad1b4e59257263b4f4ac (patch)
tree11bab12cd2ca1789d271838d887e45572b34c045 /xlators/features/changelog
parent2466f4debbb629cf847c42f5d317cd5627b095c1 (diff)
features/changelog: Cleanup .processing and .current directory
On changelog_register cleanup .processing, .history/.processing, .current and .history/.current from the working directory. Moved glusterd_recursive_rmdir and glusterd_for_each_entry to common place(libglusterfs) and renamed as recursive_rmdir and GF_FOR_EACH_ENTRY_IN_DIR respectively BUG: 1162057 Change-Id: I1f98468a344cead039026762a805437b2f9e507b Signed-off-by: Aravinda VK <avishwan@redhat.com> Reviewed-on: http://review.gluster.org/9082 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/features/changelog')
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/xlators/features/changelog/lib/src/gf-changelog.c b/xlators/features/changelog/lib/src/gf-changelog.c
index f3f6ffb..a2257a6 100644
--- a/xlators/features/changelog/lib/src/gf-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-changelog.c
@@ -108,10 +108,22 @@ gf_changelog_open_dirs (gf_changelog_t *gfc)
DIR *dir = NULL;
int tracker_fd = 0;
char tracker_path[PATH_MAX] = {0,};
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
(void) snprintf (gfc->gfc_current_dir, PATH_MAX,
"%s/"GF_CHANGELOG_CURRENT_DIR"/",
gfc->gfc_working_dir);
+
+ ret = recursive_rmdir (gfc->gfc_current_dir);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to rmdir: %s, err: %s",
+ gfc->gfc_current_dir, strerror (errno));
+ goto out;
+
ret = mkdir_p (gfc->gfc_current_dir, 0600, _gf_false);
if (ret)
goto out;
@@ -119,6 +131,7 @@ gf_changelog_open_dirs (gf_changelog_t *gfc)
(void) snprintf (gfc->gfc_processed_dir, PATH_MAX,
"%s/"GF_CHANGELOG_PROCESSED_DIR"/",
gfc->gfc_working_dir);
+
ret = mkdir_p (gfc->gfc_processed_dir, 0600, _gf_false);
if (ret)
goto out;
@@ -126,6 +139,14 @@ gf_changelog_open_dirs (gf_changelog_t *gfc)
(void) snprintf (gfc->gfc_processing_dir, PATH_MAX,
"%s/"GF_CHANGELOG_PROCESSING_DIR"/",
gfc->gfc_working_dir);
+
+ ret = recursive_rmdir (gfc->gfc_processing_dir);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to rmdir: %s, err: %s",
+ gfc->gfc_processing_dir, strerror (errno));
+ goto out;
+
ret = mkdir_p (gfc->gfc_processing_dir, 0600, _gf_false);
if (ret)
goto out;