]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: treat EROFS as expected in handle_acquire_lock()
authorIlya Dryomov <idryomov@gmail.com>
Sun, 7 Feb 2021 14:09:24 +0000 (15:09 +0100)
committerJason Dillaman <dillaman@redhat.com>
Tue, 9 Mar 2021 21:50:05 +0000 (16:50 -0500)
If the peer refuses to release exclusive lock (e.g. in case automatic
exclusive lock transitions are disabled), EROFS is retured.  Suppress
a rather confusing "Read-only file system" error message -- this case
is no different from EBUSY or EAGAIN.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 2f82c98f5a542a69057f3e78d232380eee14eff7)

src/librbd/ManagedLock.cc

index 1d3aa2d0581ba0e06228fb517da188d1f6b409ba..df01f10621799d0310420a588cb74c272f2357a8 100644 (file)
@@ -520,10 +520,10 @@ template <typename I>
 void ManagedLock<I>::handle_acquire_lock(int r) {
   ldout(m_cct, 10) << "r=" << r << dendl;
 
-  if (r == -EBUSY || r == -EAGAIN) {
+  if (r == -EBUSY || r == -EAGAIN || r == -EROFS) {
     ldout(m_cct, 5) << "unable to acquire exclusive lock" << dendl;
   } else if (r < 0) {
-    lderr(m_cct) << "failed to acquire exclusive lock:" << cpp_strerror(r)
+    lderr(m_cct) << "failed to acquire exclusive lock: " << cpp_strerror(r)
                << dendl;
   } else {
     ldout(m_cct, 5) << "successfully acquired exclusive lock" << dendl;