_rename_finish() does not send dentry link/unlink message to replicas.
We should prevent dentries that are modified by the rename operation
from getting new replicas while the rename operation is committing.
So don't set xlocks on dentries "done".
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
}
-void Locker::set_xlocks_done(Mutation *mut)
+void Locker::set_xlocks_done(Mutation *mut, bool skip_dentry)
{
for (set<SimpleLock*>::iterator p = mut->xlocks.begin();
p != mut->xlocks.end();
p++) {
+ if (skip_dentry &&
+ ((*p)->get_type() == CEPH_LOCK_DN || (*p)->get_type() == CEPH_LOCK_DVERSION))
+ continue;
dout(10) << "set_xlocks_done on " << **p << " " << *(*p)->get_parent() << dendl;
(*p)->set_xlock_done();
}
void cancel_locking(Mutation *mut, set<CInode*> *pneed_issue);
void drop_locks(Mutation *mut, set<CInode*> *pneed_issue=0);
- void set_xlocks_done(Mutation *mut);
+ void set_xlocks_done(Mutation *mut, bool skip_dentry=false);
void drop_non_rdlocks(Mutation *mut, set<CInode*> *pneed_issue=0);
void drop_rdlocks(Mutation *mut, set<CInode*> *pneed_issue=0);
MClientReply *reply = new MClientReply(mdr->client_request, 0);
reply->set_unsafe();
- // mark xlocks "done", indicating that we are exposing uncommitted changes
- mds->locker->set_xlocks_done(mdr);
+ // mark xlocks "done", indicating that we are exposing uncommitted changes.
+ //
+ //_rename_finish() does not send dentry link/unlink message to replicas.
+ // so do not set xlocks on dentries "done", the xlocks prevent dentries
+ // that have projected linkages from getting new replica.
+ mds->locker->set_xlocks_done(mdr, mdr->client_request->get_op() == CEPH_MDS_OP_RENAME);
char buf[80];
dout(10) << "early_reply " << reply->get_result()