From 4aa7bc40c9f129d6bea738941dea5b95b80d58e9 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Fri, 18 May 2012 14:58:52 +0530 Subject: features/quota: get the top xlator from the active graph outside the list In quota reconfigure we were getting the top of the active graph within the list which contains the limits set on the volume. Suppose the list is empty, then the code inside the list traversal loop is not executed, and thus top will be NULL which might lead to segfault when accessed later. Change-Id: I1648d69256490878339294537e17300399ddbf2c BUG: 822827 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.com/3364 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Anand Avati --- xlators/features/quota/src/quota.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xlators/features/quota') diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 7d5f74e9c..a5ff2373f 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -3233,9 +3233,10 @@ reconfigure (xlator_t *this, dict_t *options) LOCK (&priv->lock); { - list_for_each_entry (limit, &priv->limit_head, limit_list) { - top = ((glusterfs_ctx_t *)this->ctx)->active->top; + top = ((glusterfs_ctx_t *)this->ctx)->active->top; + GF_ASSERT (top); + list_for_each_entry (limit, &priv->limit_head, limit_list) { __quota_reconfigure (this, top->itable, limit); } -- cgit