Client::seekdir doesn't reset dirp->at_cache_name for a forward seek
within same frag. So the dentry with name == at_cache_name may not be
the one prior to the readdir postion.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
(cherry picked from commit
0e32115bae2f1ac2c59b57852976b0de5587abac)
Signed-off-by: Greg Farnum <gfarnum@redhat.com
if (it == dir->dentries.end())
return -EAGAIN;
Dentry *dn = it->second;
+ assert(dir_result_t::fpos_cmp(dn->offset, dirp->offset) < 0);
pd = xlist<Dentry*>::iterator(&dn->item_dentry_list);
++pd;
+ while (!pd.end() &&
+ dir_result_t::fpos_cmp((*pd)->offset, dirp->offset) < 0)
+ ++pd;
}
string dn_name;
static unsigned fpos_off(uint64_t p) {
return p & MASK;
}
+ static int fpos_cmp(uint64_t l, uint64_t r) {
+ int c = ceph_frag_compare(fpos_high(l), fpos_high(r));
+ if (c)
+ return c;
+ if (fpos_low(l) == fpos_low(r))
+ return 0;
+ return fpos_low(l) < fpos_low(r) ? -1 : 1;
+ }
InodeRef inode;