Skip to content

Commit

Permalink
Merge pull request #5381 from dachary/wip-12499-hammer
Browse files Browse the repository at this point in the history
ceph-fuse 0.94.2-1trusty segfaults / aborts

Reviewed-by: Greg Farnum <gfarnum@redhat.com>
  • Loading branch information
Loic Dachary committed Sep 9, 2015
2 parents 19ff928 + 256620e commit 8039375
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/client/Client.cc
Expand Up @@ -6041,8 +6041,12 @@ int Client::_readdir_cache_cb(dir_result_t *dirp, add_dirent_cb_t cb, void *p)
++pd;
}

string prev_name;
while (!pd.end()) {
string dn_name;
while (true) {
if (!dirp->inode->is_complete_and_ordered())
return -EAGAIN;
if (pd.end())
break;
Dentry *dn = *pd;
if (dn->inode == NULL) {
ldout(cct, 15) << " skipping null '" << dn->name << "'" << dendl;
Expand All @@ -6065,20 +6069,21 @@ int Client::_readdir_cache_cb(dir_result_t *dirp, add_dirent_cb_t cb, void *p)
if (pd.end())
next_off = dir_result_t::END;

dn_name = dn->name; // fill in name while we have lock

client_lock.Unlock();
int r = cb(p, &de, &st, stmask, next_off); // _next_ offset
client_lock.Lock();
ldout(cct, 15) << " de " << de.d_name << " off " << hex << dn->offset << dec
<< " = " << r
<< dendl;
if (r < 0) {
dirp->next_offset = dn->offset;
dirp->at_cache_name = prev_name;
dirp->next_offset = next_off - 1;
return r;
}

prev_name = dn->name;
dirp->offset = next_off;
dirp->next_offset = dirp->offset = next_off;
dirp->at_cache_name = dn_name; // we successfully returned this one; update!
if (r > 0)
return r;
}
Expand Down

0 comments on commit 8039375

Please sign in to comment.