diff options
author | Shreyas Siravara <sshreyas@fb.com> | 2017-04-10 12:36:21 -0700 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-12-11 15:10:32 +0000 |
commit | f9b6174a7f5eb6475ca9780b062bfb3ff1132b2d (patch) | |
tree | 2f91a5a0f40e593b7a2205fe6e63b2e36651e549 /xlators/storage | |
parent | b59e62e27cc59fa59d0f89aae2ddf115c939aa71 (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')
-rw-r--r-- | xlators/storage/posix/src/posix-common.c | 33 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix-entry-ops.c | 2 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 23 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix.h | 3 |
4 files changed, 53 insertions, 8 deletions
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c index 1b2bb609fb0..fa2655ed8c0 100644 --- a/xlators/storage/posix/src/posix-common.c +++ b/xlators/storage/posix/src/posix-common.c @@ -382,6 +382,20 @@ posix_reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("shared-brick-count", priv->shared_brick_count, options, int32, out); + + GF_OPTION_RECONF ("disable-landfill-purge", + priv->disable_landfill_purge, + options, bool, out); + if (priv->disable_landfill_purge) { + gf_log (this->name, GF_LOG_WARNING, + "Janitor WILL NOT purge the landfill directory. " + "Your landfill directory" + " may fill up this brick."); + } else { + gf_msg_debug (this->name, 0, "Janitor will purge the landfill " + "directory, which is default behavior"); + } + GF_OPTION_RECONF ("force-create-mode", force_create_mode, options, int32, out); priv->force_create_mode = force_create_mode; @@ -1064,6 +1078,16 @@ posix_init (xlator_t *this) GF_OPTION_INIT ("batch-fsync-delay-usec", _private->batch_fsync_delay_usec, uint32, out); + + GF_OPTION_INIT ("disable-landfill-purge", + _private->disable_landfill_purge, bool, out); + if (_private->disable_landfill_purge) { + gf_msg (this->name, GF_LOG_WARNING, 0, 0, + "Janitor WILL NOT purge the landfill directory. " + "Your landfill directory" + " may fill up this brick."); + } + GF_OPTION_INIT ("force-create-mode", force_create, int32, out); _private->force_create_mode = force_create; @@ -1288,6 +1312,15 @@ struct volume_options options[] = { " Useful for displaying the proper usable size through statvfs() " "call (df command)", }, + { + .key = {"disable-landfill-purge"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", + .description = "Disable glusterfs/landfill purges. " + "WARNING: This can fill up a brick.", + .op_version = {GD_OP_VERSION_4_0_0}, + .tags = {"diagnosis"}, + }, { .key = {"force-create-mode"}, .type = GF_OPTION_TYPE_INT, .min = 0000, diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c index e7658e46543..9d336ee5f60 100644 --- a/xlators/storage/posix/src/posix-entry-ops.c +++ b/xlators/storage/posix/src/posix-entry-ops.c @@ -1281,6 +1281,8 @@ posix_rmdir (call_frame_t *frame, xlator_t *this, } else { (void) snprintf (tmp_path, sizeof(tmp_path), "%s/%s", priv->trash_path, gfid_str); + gf_msg_debug (this->name, 0, + "Moving %s to %s", real_path, tmp_path); op_ret = sys_rename (real_path, tmp_path); pthread_cond_signal (&priv->janitor_cond); } 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; } diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h index afb4b4413f6..f9ab3ec9e75 100644 --- a/xlators/storage/posix/src/posix.h +++ b/xlators/storage/posix/src/posix.h @@ -233,6 +233,9 @@ struct posix_private { same backend. Very much usable in brick-splitting feature. */ int32_t shared_brick_count; + /* This option is used for either to call a landfill_purge or not */ + gf_boolean_t disable_landfill_purge; + /*Option to set mode bit permission that will always be set on file/directory. */ mode_t force_create_mode; |