From f9b6174a7f5eb6475ca9780b062bfb3ff1132b2d Mon Sep 17 00:00:00 2001 From: Shreyas Siravara Date: Mon, 10 Apr 2017 12:36:21 -0700 Subject: posix: Add option to disable nftw() based deletes when purging the landfill directory Summary: - We may have found an issue where certain directories were being moved into .landfill and then being quickly purged via nftw(). - We would like to have an emergency option to disable these purges. > Reviewed-on: https://review.gluster.org/18253 > Reviewed-by: Shreyas Siravara Fixes #371 Change-Id: I90b54c535930c1ca2925a928728199b6b80eadd9 Signed-off-by: Amar Tumballi --- xlators/storage/posix/src/posix-helpers.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'xlators/storage/posix/src/posix-helpers.c') diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 8f550f9fe0d..525f65f7eba 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -1414,15 +1414,22 @@ posix_janitor_thread_proc (void *data) time (&now); if ((now - priv->last_landfill_check) > priv->janitor_sleep_duration) { - gf_msg_trace (this->name, 0, - "janitor cleaning out %s", - priv->trash_path); - - nftw (priv->trash_path, - janitor_walker, - 32, - FTW_DEPTH | FTW_PHYS); + if (priv->disable_landfill_purge) { + gf_msg_debug (this->name, 0, + "Janitor would have " + "cleaned out %s, but purge" + "is disabled.", + priv->trash_path); + } else { + gf_msg_trace (this->name, 0, + "janitor cleaning out %s", + priv->trash_path); + nftw (priv->trash_path, + janitor_walker, + 32, + FTW_DEPTH | FTW_PHYS); + } priv->last_landfill_check = now; } -- cgit