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
This commit is contained in:
parent
fa598e1bbb
commit
24309c6e13
@ -2121,9 +2121,9 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
|
||||
goto done;
|
||||
|
||||
if (!local->layout)
|
||||
local->layout = layout = dht_layout_get (this, local->fd->inode);
|
||||
else
|
||||
layout = local->layout;
|
||||
local->layout = dht_layout_get (this, local->fd->inode);
|
||||
|
||||
layout = local->layout;
|
||||
|
||||
list_for_each_entry (orig_entry, (&orig_entries->list), list) {
|
||||
next_offset = orig_entry->d_off;
|
||||
@ -2225,46 +2225,36 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
if (op_ret < 0)
|
||||
goto done;
|
||||
|
||||
layout = dht_layout_get (this, local->fd->inode);
|
||||
if (!local->layout)
|
||||
local->layout = dht_layout_get (this, local->fd->inode);
|
||||
|
||||
layout = local->layout;
|
||||
|
||||
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;
|
||||
}
|
||||
subvol = dht_layout_search (this, layout, orig_entry->d_name);
|
||||
|
||||
entry = gf_dirent_for_name (orig_entry->d_name);
|
||||
if (!entry) {
|
||||
gf_log (this->name, GF_LOG_ERROR,
|
||||
"Out of memory");
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
/* 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,
|
||||
"memory allocation failed :(");
|
||||
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);
|
||||
|
||||
entry->d_type = orig_entry->d_type;
|
||||
entry->d_len = orig_entry->d_len;
|
||||
|
||||
list_add_tail (&entry->list, &entries.list);
|
||||
count++;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
list_add_tail (&entry->list, &entries.list);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
op_ret = count;
|
||||
|
||||
done:
|
||||
|
Loading…
x
Reference in New Issue
Block a user