From: Sage Weil Date: Fri, 9 Nov 2012 13:28:12 +0000 (-0800) Subject: mds: re-try_set_loner() after doing evals in eval(CInode*, int mask) X-Git-Tag: v0.55~136 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ae1f46c3b5f09ce0a6c72e7f6af3c80fa1813b0d;p=ceph.git mds: re-try_set_loner() after doing evals in eval(CInode*, int mask) Consider a case where current loner is A and wanted loner is B. At the top of the function we try to set the loner, but that may fail because we haven't processed the gathered caps yet for the previous loner. In the body we do that and potentially drop the old loner, but we do not try_set_loner() again on the desired loner. Try after our drop. If it succeeds, loop through the eval's one more time so that we can issue caps approriately. This fixes a hang induced by a simple loop like: while true ; do echo asdf >> mnt.a/foo ; tail mnt.b/foo ; done & while true ; do ls mnt.a mnt.b ; done (The second loop may not be necessary.) Signed-off-by: Sage Weil --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index bf4d931b7f97..9d917486eb1e 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -779,7 +779,8 @@ bool Locker::eval(CInode *in, int mask) } else dout(10) << "eval doesn't want loner" << dendl; } - + + retry: if (mask & CEPH_LOCK_IFILE) eval_any(&in->filelock, &need_issue); if (mask & CEPH_LOCK_IAUTH) @@ -801,6 +802,16 @@ bool Locker::eval(CInode *in, int mask) if (in->try_drop_loner()) { dout(10) << " dropped loner" << dendl; need_issue = true; + + if (in->get_wanted_loner() >= 0) { + if (in->try_set_loner()) { + dout(10) << "eval end set loner to client." << in->get_loner() << dendl; + mask = -1; + goto retry; + } else { + dout(10) << "eval want loner client." << in->get_wanted_loner() << " but failed to set it" << dendl; + } + } } }