diff options
author | Sanoj Unnikrishnan <sunnikri@redhat.com> | 2017-01-18 15:56:00 +0530 |
---|---|---|
committer | Raghavendra Talur <rtalur@redhat.com> | 2017-05-31 05:58:24 +0000 |
commit | 37bec170521e6bfa994648fad5ba2e3769a87628 (patch) | |
tree | bd3062c1bccb228eeda5d50e8ae9af485ecd423c | |
parent | 86988ace69eefab71eabb54641a7a3cf7c5e6717 (diff) |
Fixes upgrade issue in quota.conf
When an op-version bump up is done the glusterd_store_quota_config
upgrades the quota conf file, although overwriting the same later
which leaves out all gfid entries. While this is warranted for
enable opcode, for upgrade we need to retain gfids. So for upgrade
opcode, we return once the upgrade is done.
> Reviewed-on: http://review.gluster.org/16425
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
> (cherry picked from commit 89cf743118ab6554c7f210754e51c4921cbb60c7)
Change-Id: I2b38c6022d74b4a14dc07432651a51cc39ad5120
BUG: 1450773
Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
Reviewed-on: https://review.gluster.org/17292
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 0e6629cf0dd..a7b98467c20 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -1064,6 +1064,11 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path, if (ret) goto out; + if (GF_QUOTA_OPTION_TYPE_UPGRADE == opcode) { + /* Nothing more to be done here */ + goto out; + } + conf_fd = open (volinfo->quota_conf_shandle->path, O_RDONLY); if (conf_fd == -1) { ret = -1; @@ -1073,6 +1078,9 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path, ret = quota_conf_skip_header (conf_fd); if (ret) goto out; + } else if (GF_QUOTA_OPTION_TYPE_UPGRADE == opcode) { + /* No change to be done in quota_conf*/ + goto out; } /* If op-ver is gt 3.7, then quota.conf will be upgraded, and 17 bytes @@ -1095,12 +1103,7 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path, /* Just create empty quota.conf file if create */ if (GF_QUOTA_OPTION_TYPE_ENABLE == opcode || - GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS == opcode || - GF_QUOTA_OPTION_TYPE_UPGRADE == opcode) { - /* Opcode will be GF_QUOTA_OPTION_TYPE_UPGRADE when there is - * an upgrade from 3.6 to 3.7. Just upgrade the quota.conf - * file even during an op-version bumpup and exit. - */ + GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS == opcode) { modified = _gf_true; goto out; } @@ -1229,7 +1232,7 @@ out: if (ret && (fd > 0)) { gf_store_unlink_tmppath (volinfo->quota_conf_shandle); - } else if (!ret) { + } else if (!ret && GF_QUOTA_OPTION_TYPE_UPGRADE != opcode) { ret = gf_store_rename_tmppath (volinfo->quota_conf_shandle); if (modified) { ret = glusterd_compute_cksum (volinfo, _gf_true); |