]> git.apps.os.sepia.ceph.com Git - ceph-ci.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)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 9 Feb 2021 13:29:35 +0000 (14:29 +0100)
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>
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;