diff options
Diffstat (limited to 'xlators/cluster/afr/src/afr-dir-read.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-read.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c index 5af168bf..501cc3e8 100644 --- a/xlators/cluster/afr/src/afr-dir-read.c +++ b/xlators/cluster/afr/src/afr-dir-read.c @@ -513,7 +513,7 @@ afr_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int child_index = -1; - uint64_t ctx = 0; + uint64_t ctx = 0; afr_fd_ctx_t *fd_ctx = NULL; off_t offset = 0; @@ -559,20 +559,22 @@ afr_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } - list_for_each_entry_safe (entry, tmp, &entries->list, list) { - inum = afr_itransform (entry->d_ino, priv->child_count, - child_index); - entry->d_ino = inum; - inum = afr_itransform (entry->d_stat.ia_ino, - priv->child_count, child_index); - entry->d_stat.ia_ino = inum; - - if ((local->fd->inode == local->fd->inode->table->root) - && !strcmp (entry->d_name, GF_REPLICATE_TRASH_DIR)) { - list_del_init (&entry->list); - FREE (entry); - } - } + if (op_ret != -1) { + list_for_each_entry_safe (entry, tmp, &entries->list, list) { + inum = afr_itransform (entry->d_ino, priv->child_count, + child_index); + entry->d_ino = inum; + inum = afr_itransform (entry->d_stat.ia_ino, + priv->child_count, child_index); + entry->d_stat.ia_ino = inum; + + if ((local->fd->inode == local->fd->inode->table->root) + && !strcmp (entry->d_name, GF_REPLICATE_TRASH_DIR)) { + list_del_init (&entry->list); + FREE (entry); + } + } + } if (priv->strict_readdir) { if (fd_ctx->failed_over) { |