When handling trans-authority rename, the master mds may ask slave
mds to wrlock a lock, then try to wrlock the same lock locally.
If the master can't wrlock the lock locally, it need to drop the
remote wrlock and wait. Otherwise deadlock happens. The code does
not handle a corner case: Lock::wrlock_start() can sleep even
when SimpleLock::can_wrlock() return true.
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
remote_wrlock_start(*p, (*remote_wrlocks)[*p], mdr);
goto out;
}
- if (!wrlock_start(*p, mdr))
+ // nowait if we have already gotten remote wrlock
+ if (!wrlock_start(*p, mdr, need_remote_wrlock))
goto out;
dout(10) << " got wrlock on " << **p << " " << *(*p)->get_parent() << dendl;
}