diff options
| author | Raghavendra G <raghavendra@gluster.com> | 2011-04-19 04:56:58 +0000 | 
|---|---|---|
| committer | Anand Avati <avati@gluster.com> | 2011-04-21 00:39:23 -0700 | 
| commit | 698d972d8256662dc23a012c4328dca37aaced56 (patch) | |
| tree | 005036fcead2077831d07048308a149917333798 | |
| parent | 450a7be2cede5a44c74f5f74224292af0c81a45f (diff) | |
features/marker-quota: initialize dentry_child_count to total number of children a directory has in a single go.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2809 ([e89f2a1f5daf1513c533a47b90aec8f90702d09f]: glusterfsd crashed in quota_dirty_inode_readdir)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2809
| -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),  | 
