From a3a38bb9cd2c17bd955489ae87800f398ef10239 Mon Sep 17 00:00:00 2001 From: Sanoj Unnikrishnan Date: Wed, 1 Feb 2017 19:15:29 +0530 Subject: 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. Change-Id: I3ac8e8a7a62d34e1fa8fd2734419459112c71797 BUG: 1418259 Signed-off-by: Sanoj Unnikrishnan Reviewed-on: https://review.gluster.org/16507 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Manikandan Selvaganesh Reviewed-by: Raghavendra G --- cli/src/cli-rpc-ops.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index b56457ecf63..7cdbaf0cad9 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -3951,14 +3951,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) { @@ -3968,17 +3960,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 -- cgit