]> 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>
Thu, 11 Feb 2021 19:32:58 +0000 (14:32 -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 a74b59dfb2f02bb9a6040da3fe9e482cad080430..53a0cf911ec8207dd419315417528d2f6949ed14 100644 (file)
@@ -522,10 +522,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;