diff options
| author | Anand Avati <avati@gluster.com> | 2010-02-23 04:13:00 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2010-02-23 01:56:55 -0800 | 
| commit | 4f7edf59f42e5f6a4b75eb7a947755b582ca8fd2 (patch) | |
| tree | e6b859b5a0e8099272397a0f9d62d74901073844 | |
| parent | 71d5afaa15de1d1066799e2de54fe88182453ff1 (diff) | |
dht: fix READDIR semantics which got broken in 512dcad823feb199d78f5b66a09bc404ccb899e8
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 584 (automatically configure 'lookup-unhashed' option)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=584
| -rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 51 | 
1 files changed, 21 insertions, 30 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 14890965b50..6fdebee8884 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2070,7 +2070,11 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,  	if (op_ret < 0)  		goto done; -        layout = dht_layout_get (this, local->fd->inode); +        if (!local->layout) +                local->layout = layout = dht_layout_get (this, local->fd->inode); +        else +                layout = local->layout; +  	list_for_each_entry (orig_entry, (&orig_entries->list), list) {                  next_offset = orig_entry->d_off; @@ -2180,40 +2184,27 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,  	list_for_each_entry (orig_entry, (&orig_entries->list), list) {                  next_offset = orig_entry->d_off; -                if (check_is_linkfile (NULL, (&orig_entry->d_stat), NULL) -                    || (check_is_dir (NULL, (&orig_entry->d_stat), NULL) -                        && (prev->this != dht_first_up_subvol (this)))) { -                        continue; -                } - -                entry = gf_dirent_for_name (orig_entry->d_name); -                if (!entry) { -                        gf_log (this->name, GF_LOG_ERROR, -                                "Out of memory"); -                        goto unwind; -                } +                subvol = dht_layout_search (this, layout, orig_entry->d_name); -                /* Do this if conf->search_unhashed is set to "auto" */ -                if (conf->search_unhashed == GF_DHT_LOOKUP_UNHASHED_AUTO) { -                        subvol = dht_layout_search (this, layout, -                                                    orig_entry->d_name); -                        if (!subvol || (subvol != prev->this)) { -                                /* TODO: Count the number of entries which need -                                   linkfile to prove its existance in fs */ -                                layout->search_unhashed++; +                if (!subvol || (subvol != prev->this)) { +                        entry = gf_dirent_for_name (orig_entry->d_name); +                        if (!entry) { +                                gf_log (this->name, GF_LOG_ERROR, +                                        "Out of memory"); +                                goto unwind;                          } -                } -                dht_itransform (this, prev->this, orig_entry->d_ino, -                                &entry->d_ino); -                dht_itransform (this, prev->this, orig_entry->d_off, -                                &entry->d_off); +                        dht_itransform (this, prev->this, orig_entry->d_ino, +                                        &entry->d_ino); +                        dht_itransform (this, prev->this, orig_entry->d_off, +                                        &entry->d_off); -                entry->d_type = orig_entry->d_type; -                entry->d_len  = orig_entry->d_len; +                        entry->d_type = orig_entry->d_type; +                        entry->d_len  = orig_entry->d_len; -                list_add_tail (&entry->list, &entries.list); -                count++; +                        list_add_tail (&entry->list, &entries.list); +                        count++; +                }  	}  	op_ret = count;  | 
