Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mds: don't modify inode that is not projected #13052

Merged
merged 1 commit into from
Jan 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1770,8 +1770,18 @@ void MDCache::project_rstat_inode_to_frag(CInode *cur, CDir *parent, snapid_t fi
return;
}

if (cur->last >= floor)
_project_rstat_inode_to_frag(*curi, MAX(first, floor), cur->last, parent, linkunlink);
if (cur->last >= floor) {
bool update = true;
if (cur->state_test(CInode::STATE_AMBIGUOUSAUTH) && cur->is_auth()) {
// rename src inode is not projected in the slave rename prep case. so we should
// avoid updateing the inode.
assert(linkunlink < 0);
assert(cur->is_frozen_inode());
update = false;
}
_project_rstat_inode_to_frag(*curi, MAX(first, floor), cur->last, parent,
linkunlink, update);
}

if (g_conf->mds_snap_rstat) {
for (compact_set<snapid_t>::iterator p = cur->dirty_old_rstats.begin();
Expand All @@ -1783,15 +1793,15 @@ void MDCache::project_rstat_inode_to_frag(CInode *cur, CDir *parent, snapid_t fi
if (q == snaps.end() || *q > *p)
continue;
if (*p >= floor)
_project_rstat_inode_to_frag(old.inode, ofirst, *p, parent, 0);
_project_rstat_inode_to_frag(old.inode, ofirst, *p, parent, 0, false);
}
}
cur->dirty_old_rstats.clear();
}


void MDCache::_project_rstat_inode_to_frag(inode_t& inode, snapid_t ofirst, snapid_t last,
CDir *parent, int linkunlink)
CDir *parent, int linkunlink, bool update_inode)
{
dout(10) << "_project_rstat_inode_to_frag [" << ofirst << "," << last << "]" << dendl;
dout(20) << " inode rstat " << inode.rstat << dendl;
Expand All @@ -1807,7 +1817,8 @@ void MDCache::_project_rstat_inode_to_frag(inode_t& inode, snapid_t ofirst, snap
}
dout(20) << " delta " << delta << dendl;

inode.accounted_rstat = inode.rstat;
if (update_inode)
inode.accounted_rstat = inode.rstat;

while (last >= ofirst) {
/*
Expand Down Expand Up @@ -1900,7 +1911,8 @@ void MDCache::_project_rstat_inode_to_frag(inode_t& inode, snapid_t ofirst, snap
dout(20) << " project to [" << first << "," << last << "] " << *prstat << dendl;
assert(last >= first);
prstat->add(delta);
inode.accounted_rstat = inode.rstat;
if (update_inode)
inode.accounted_rstat = inode.rstat;
dout(20) << " result [" << first << "," << last << "] " << *prstat << " " << *parent << dendl;

last = first-1;
Expand Down
2 changes: 1 addition & 1 deletion src/mds/MDCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class MDCache {
void project_rstat_inode_to_frag(CInode *cur, CDir *parent, snapid_t first,
int linkunlink, SnapRealm *prealm);
void _project_rstat_inode_to_frag(inode_t& inode, snapid_t ofirst, snapid_t last,
CDir *parent, int linkunlink=0);
CDir *parent, int linkunlink, bool update_inode);
void project_rstat_frag_to_inode(nest_info_t& rstat, nest_info_t& accounted_rstat,
snapid_t ofirst, snapid_t last,
CInode *pin, bool cow_head);
Expand Down
2 changes: 1 addition & 1 deletion src/mds/Server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7723,7 +7723,7 @@ void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef
if (srcdn && srcdn->authority().first == whoami) {
nest_info_t blah;
_rollback_repair_dir(mut, srcdir, rollback.orig_src, rollback.ctime,
in ? in->is_dir() : false, 1, pi ? pi->rstat : blah);
in ? in->is_dir() : false, 1, pi ? pi->accounted_rstat : blah);
}

// repair dest
Expand Down