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