summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-helpers.c
diff options
context:
space:
mode:
authorShreyas Siravara <sshreyas@fb.com>2017-04-10 12:36:21 -0700
committerJeff Darcy <jeff@pl.atyp.us>2017-12-11 15:10:32 +0000
commitf9b6174a7f5eb6475ca9780b062bfb3ff1132b2d (patch)
tree2f91a5a0f40e593b7a2205fe6e63b2e36651e549 /xlators/storage/posix/src/posix-helpers.c
parentb59e62e27cc59fa59d0f89aae2ddf115c939aa71 (diff)
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 <sshreyas@fb.com> Fixes #371 Change-Id: I90b54c535930c1ca2925a928728199b6b80eadd9 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-helpers.c')
-rw-r--r--xlators/storage/posix/src/posix-helpers.c23
1 files changed, 15 insertions, 8 deletions
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;
}