summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2013-01-19 08:30:23 +0800
committerYan, Zheng <zheng.z.yan@intel.com>2013-01-29 10:17:05 +0800
commitcd8d91078c65b1e029354f0fdddbd0574f03d26b (patch)
tree082f0d8e79521d7268ccf23426e3742f628e8679
parent659d1a39458fdc2b73ad2d3512d1ea2ce6f7566d (diff)
downloadceph-cd8d91078c65b1e029354f0fdddbd0574f03d26b.tar.gz
mds: don't set xlocks on dentries done when early reply rename
_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>
-rw-r--r--src/mds/Locker.cc5
-rw-r--r--src/mds/Locker.h2
-rw-r--r--src/mds/Server.cc8
3 files changed, 11 insertions, 4 deletions
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index e0c149fb762..8847db69339 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -460,11 +460,14 @@ bool Locker::acquire_locks(MDRequest *mdr,
}
-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();
}
diff --git a/src/mds/Locker.h b/src/mds/Locker.h
index 04a5252fcad..f00592587bb 100644
--- a/src/mds/Locker.h
+++ b/src/mds/Locker.h
@@ -93,7 +93,7 @@ public:
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);
diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index eced76fe5f5..92062f74f59 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -811,8 +811,12 @@ void Server::early_reply(MDRequest *mdr, CInode *tracei, CDentry *tracedn)
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()