|
|
3604df |
From 6de89dc654727526c5daa2f88095ce71afbc8c80 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Sanoj Unnikrishnan <sunnikri@redhat.com>
|
|
|
3604df |
Date: Thu, 19 Jan 2017 20:34:43 +0530
|
|
|
3604df |
Subject: [PATCH 272/275] Fixes upgrade issue in quota.conf
|
|
|
3604df |
|
|
|
3604df |
When an op-version bump up is done the glusterd_store_quota_config
|
|
|
3604df |
upgrades the quota conf file, although overwriting the same later
|
|
|
3604df |
which leaves out all gfid entries. While this is warranted for
|
|
|
3604df |
enable opcode, for upgrade we need to retain gfids. So for upgrade
|
|
|
3604df |
opcode, we return once the upgrade is done.
|
|
|
3604df |
|
|
|
3604df |
> Change-Id: I2b38c6022d74b4a14dc07432651a51cc39ad5120
|
|
|
3604df |
> BUG: 1414346
|
|
|
3604df |
> Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
|
|
|
3604df |
> Reviewed-on: http://review.gluster.org/16425
|
|
|
3604df |
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I57f109717370fdbc02d331a4588fd2bf8edb8f7a
|
|
|
3604df |
BUG: 1412955
|
|
|
3604df |
Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/95825
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-quota.c | 17 ++++++++++-------
|
|
|
3604df |
1 file changed, 10 insertions(+), 7 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
|
|
|
3604df |
index 08fc74f..451eb86 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
|
|
|
3604df |
@@ -1068,6 +1068,11 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
|
|
|
3604df |
if (ret)
|
|
|
3604df |
goto out;
|
|
|
3604df |
|
|
|
3604df |
+ if (GF_QUOTA_OPTION_TYPE_UPGRADE == opcode) {
|
|
|
3604df |
+ /* Nothing more to be done here */
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
conf_fd = open (volinfo->quota_conf_shandle->path, O_RDONLY);
|
|
|
3604df |
if (conf_fd == -1) {
|
|
|
3604df |
ret = -1;
|
|
|
3604df |
@@ -1077,6 +1082,9 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
|
|
|
3604df |
ret = quota_conf_skip_header (conf_fd);
|
|
|
3604df |
if (ret)
|
|
|
3604df |
goto out;
|
|
|
3604df |
+ } else if (GF_QUOTA_OPTION_TYPE_UPGRADE == opcode) {
|
|
|
3604df |
+ /* No change to be done in quota_conf*/
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
/* If op-ver is gt 3.7, then quota.conf will be upgraded, and 17 bytes
|
|
|
3604df |
@@ -1099,12 +1107,7 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
|
|
|
3604df |
|
|
|
3604df |
/* Just create empty quota.conf file if create */
|
|
|
3604df |
if (GF_QUOTA_OPTION_TYPE_ENABLE == opcode ||
|
|
|
3604df |
- GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS == opcode ||
|
|
|
3604df |
- GF_QUOTA_OPTION_TYPE_UPGRADE == opcode) {
|
|
|
3604df |
- /* Opcode will be GF_QUOTA_OPTION_TYPE_UPGRADE when there is
|
|
|
3604df |
- * an upgrade from 3.6 to 3.7. Just upgrade the quota.conf
|
|
|
3604df |
- * file even during an op-version bumpup and exit.
|
|
|
3604df |
- */
|
|
|
3604df |
+ GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS == opcode) {
|
|
|
3604df |
modified = _gf_true;
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
@@ -1233,7 +1236,7 @@ out:
|
|
|
3604df |
|
|
|
3604df |
if (ret && (fd > 0)) {
|
|
|
3604df |
gf_store_unlink_tmppath (volinfo->quota_conf_shandle);
|
|
|
3604df |
- } else if (!ret) {
|
|
|
3604df |
+ } else if (!ret && GF_QUOTA_OPTION_TYPE_UPGRADE != opcode) {
|
|
|
3604df |
ret = gf_store_rename_tmppath (volinfo->quota_conf_shandle);
|
|
|
3604df |
if (modified) {
|
|
|
3604df |
ret = glusterd_compute_cksum (volinfo, _gf_true);
|
|
|
3604df |
--
|
|
|
3604df |
2.9.3
|
|
|
3604df |
|