From 2f7eb2535d7c63332059d71b7fb020c560079010 Mon Sep 17 00:00:00 2001
From: Sanoj Unnikrishnan <sunnikri@redhat.com>
Date: Wed, 1 Feb 2017 19:15:29 +0530
Subject: [PATCH 326/361] Fixes quota list when stale gfid exist in quota.conf
when an rmdir is done, the gfid corresponding to the dir remains
in quota.conf (if a limit was configured on the dir). The quota
list should ignore them and print the remaining limits. In case
the last gfid in quota.conf happened to be stale, the print code
was getting skipped. Refactored the code to ensure printing happens.
mainline:
> BUG: 1418259
> Reviewed-on: https://review.gluster.org/16507
> 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: Manikandan Selvaganesh <manikandancs333@gmail.com>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
(cherry picked from commit 392b16d1f1488ae33cd6065668d52ce74a5583d7)
BUG: 1418227
Change-Id: I3ac8e8a7a62d34e1fa8fd2734419459112c71797
Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/101307
Tested-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
cli/src/cli-rpc-ops.c | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index cc395d7..280605c 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -3918,14 +3918,6 @@ cli_quotad_getlimit_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- ret = dict_get_int32 (local->dict, "max_count",
- &max_count);
- if (ret < 0) {
- gf_log ("cli", GF_LOG_ERROR,
- "failed to get max_count");
- goto out;
- }
-
node = list_node_add_order (dict, &local->dict_list,
cli_quota_compare_path);
if (node == NULL) {
@@ -3935,17 +3927,28 @@ cli_quotad_getlimit_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- if (list_count == max_count) {
- list_for_each_entry_safe (node, tmpnode,
- &local->dict_list, list) {
- dict = node->ptr;
- print_quota_list_from_quotad (frame, dict);
- list_node_del (node);
- dict_unref (dict);
- }
+ }
+
+ ret = dict_get_int32 (local->dict, "max_count",
+ &max_count);
+ if (ret < 0) {
+ gf_log ("cli", GF_LOG_ERROR,
+ "failed to get max_count");
+ goto out;
+ }
+
+ if (list_count == max_count) {
+ list_for_each_entry_safe (node, tmpnode,
+ &local->dict_list, list) {
+ dict = node->ptr;
+ print_quota_list_from_quotad (frame, dict);
+ list_node_del (node);
+ dict_unref (dict);
}
}
+
+
out:
/* Bad Fix: CLI holds the lock to process a command.
* When processing quota list command, below sequence of steps executed
--
1.8.3.1