diff options
-rw-r--r-- | xlators/features/marker/src/marker-quota.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c index 6230751542c..5fe8ab010da 100644 --- a/xlators/features/marker/src/marker-quota.c +++ b/xlators/features/marker/src/marker-quota.c @@ -396,8 +396,10 @@ quota_readdir_cbk (call_frame_t *frame, list_for_each_entry (entry, (&entries->list), list) { gf_log (this->name, GF_LOG_DEBUG, "entry = %s", entry->d_name); - if ((!strcmp (entry->d_name, ".")) || (!strcmp (entry->d_name, ".."))) { - gf_log (this->name, GF_LOG_DEBUG, "entry = %s", entry->d_name); + if ((!strcmp (entry->d_name, ".")) || (!strcmp (entry->d_name, + ".."))) { + gf_log (this->name, GF_LOG_DEBUG, "entry = %s", + entry->d_name); continue; } count++; @@ -405,11 +407,22 @@ quota_readdir_cbk (call_frame_t *frame, local->frame = frame; + if (count > 0) { + LOCK (&local->lock); + { + local->dentry_child_count = count; + } + UNLOCK (&local->lock); + } + + list_for_each_entry (entry, (&entries->list), list) { gf_log (this->name, GF_LOG_DEBUG, "entry = %s", entry->d_name); - if ((!strcmp (entry->d_name, ".")) || (!strcmp (entry->d_name, ".."))) { - gf_log (this->name, GF_LOG_DEBUG, "entry = %s", entry->d_name); + if ((!strcmp (entry->d_name, ".")) || (!strcmp (entry->d_name, + ".."))) { + gf_log (this->name, GF_LOG_DEBUG, "entry = %s", + entry->d_name); offset = entry->d_off; continue; } @@ -441,8 +454,6 @@ quota_readdir_cbk (call_frame_t *frame, if (ret) goto out; - QUOTA_SAFE_INCREMENT (&local->lock, local->dentry_child_count); - STACK_WIND (newframe, get_child_contribution, FIRST_CHILD(this), |