|
|
14f8ab |
From 43a8e2c7441b14f5f238cb11d83f32f248b16abb Mon Sep 17 00:00:00 2001
|
|
|
14f8ab |
From: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
14f8ab |
Date: Tue, 13 Oct 2020 18:56:20 +0530
|
|
|
14f8ab |
Subject: [PATCH 505/511] trash: Create inode_table only while feature is
|
|
|
14f8ab |
enabled
|
|
|
14f8ab |
|
|
|
14f8ab |
Currently trash xlator create a inode table(1M) even if
|
|
|
14f8ab |
feature is not enabled.In brick_mux environment while 250
|
|
|
14f8ab |
bricks are attached with a single brick process and feature
|
|
|
14f8ab |
is not enable brick process increase RSS size unnecessarily.
|
|
|
14f8ab |
|
|
|
14f8ab |
Solution: Create inode_table only while a feature is enabled.
|
|
|
14f8ab |
The patch reduces 250M RSS size per brick process
|
|
|
14f8ab |
if trash feature is not enabled.
|
|
|
14f8ab |
|
|
|
14f8ab |
> Change-Id: I11a6fd2b8419fe2988f398be6ec30fb4f3b99a5d
|
|
|
14f8ab |
> Fixes: #1543
|
|
|
14f8ab |
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
14f8ab |
> (Cherry pick from commit 32f25e7b1b4b080ab2640e178b407c878e629376)
|
|
|
14f8ab |
> (Reviewed on upstream link https://github.com/gluster/glusterfs/issues/1543)
|
|
|
14f8ab |
|
|
|
14f8ab |
Change-Id: I11a6fd2b8419fe2988f398be6ec30fb4f3b99a5d
|
|
|
14f8ab |
BUG: 1898781
|
|
|
14f8ab |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
14f8ab |
Reviewed-on: https://code.engineering.redhat.com/gerrit/221184
|
|
|
14f8ab |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
14f8ab |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
14f8ab |
---
|
|
|
14f8ab |
xlators/features/trash/src/trash.c | 47 +++++++++++++++++++++++++++++++++++---
|
|
|
14f8ab |
1 file changed, 44 insertions(+), 3 deletions(-)
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
|
|
|
14f8ab |
index f96ed73..93f020f 100644
|
|
|
14f8ab |
--- a/xlators/features/trash/src/trash.c
|
|
|
14f8ab |
+++ b/xlators/features/trash/src/trash.c
|
|
|
14f8ab |
@@ -2235,16 +2235,47 @@ reconfigure(xlator_t *this, dict_t *options)
|
|
|
14f8ab |
char trash_dir[PATH_MAX] = {
|
|
|
14f8ab |
0,
|
|
|
14f8ab |
};
|
|
|
14f8ab |
+ gf_boolean_t active_earlier = _gf_false;
|
|
|
14f8ab |
+ gf_boolean_t active_now = _gf_false;
|
|
|
14f8ab |
|
|
|
14f8ab |
priv = this->private;
|
|
|
14f8ab |
|
|
|
14f8ab |
GF_VALIDATE_OR_GOTO("trash", priv, out);
|
|
|
14f8ab |
|
|
|
14f8ab |
+ active_earlier = priv->state;
|
|
|
14f8ab |
+ GF_OPTION_RECONF("trash", active_now, options, bool, out);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ /* Disable of trash feature is not allowed at this point until
|
|
|
14f8ab |
+ we are not able to find an approach to cleanup resource
|
|
|
14f8ab |
+ gracefully. Here to disable the feature need to destroy inode
|
|
|
14f8ab |
+ table and currently it is difficult to ensure inode is not
|
|
|
14f8ab |
+ being used
|
|
|
14f8ab |
+ */
|
|
|
14f8ab |
+ if (active_earlier && !active_now) {
|
|
|
14f8ab |
+ gf_log(this->name, GF_LOG_INFO,
|
|
|
14f8ab |
+ "Disable of trash feature is not allowed "
|
|
|
14f8ab |
+ "during graph reconfigure");
|
|
|
14f8ab |
+ ret = 0;
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ if (!active_earlier && active_now) {
|
|
|
14f8ab |
+ if (!priv->trash_itable) {
|
|
|
14f8ab |
+ priv->trash_itable = inode_table_new(0, this);
|
|
|
14f8ab |
+ if (!priv->trash_itable) {
|
|
|
14f8ab |
+ ret = -ENOMEM;
|
|
|
14f8ab |
+ gf_log(this->name, GF_LOG_ERROR,
|
|
|
14f8ab |
+ "failed to create trash inode_table"
|
|
|
14f8ab |
+ " during graph reconfigure");
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ priv->state = active_now;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
GF_OPTION_RECONF("trash-internal-op", priv->internal, options, bool, out);
|
|
|
14f8ab |
GF_OPTION_RECONF("trash-dir", tmp, options, str, out);
|
|
|
14f8ab |
|
|
|
14f8ab |
- GF_OPTION_RECONF("trash", priv->state, options, bool, out);
|
|
|
14f8ab |
-
|
|
|
14f8ab |
if (priv->state) {
|
|
|
14f8ab |
ret = create_or_rename_trash_directory(this);
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -2501,7 +2532,17 @@ init(xlator_t *this)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- priv->trash_itable = inode_table_new(0, this);
|
|
|
14f8ab |
+ if (priv->state) {
|
|
|
14f8ab |
+ priv->trash_itable = inode_table_new(0, this);
|
|
|
14f8ab |
+ if (!priv->trash_itable) {
|
|
|
14f8ab |
+ ret = -ENOMEM;
|
|
|
14f8ab |
+ priv->state = _gf_false;
|
|
|
14f8ab |
+ gf_log(this->name, GF_LOG_ERROR,
|
|
|
14f8ab |
+ "failed to create trash inode_table disable trash");
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
gf_log(this->name, GF_LOG_DEBUG, "brick path is%s", priv->brick_path);
|
|
|
14f8ab |
|
|
|
14f8ab |
this->private = (void *)priv;
|
|
|
14f8ab |
--
|
|
|
14f8ab |
1.8.3.1
|
|
|
14f8ab |
|