]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: make sure the callback is finished when returning ENOTCONN
authorDhairya Parmar <dparmar@redhat.com>
Fri, 24 Nov 2023 13:53:25 +0000 (19:23 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Tue, 30 Jan 2024 09:20:57 +0000 (14:50 +0530)
when the client is not mounted

Fixes: https://tracker.ceph.com/issues/63629
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
src/client/Client.cc

index 58a289d1a23a9f2546a2198ce38fd4e43147c30f..8682423ea1e1be9cef206b7f898700f06c9af499 100644 (file)
@@ -15948,12 +15948,21 @@ int64_t Client::ll_preadv_pwritev(struct Fh *fh, const struct iovec *iov,
                                   bool do_fsync, bool syncdataonly)
 {
     RWRef_t mref_reader(mount_state, CLIENT_MOUNTING);
-    if (!mref_reader.is_state_satisfied())
-      return -CEPHFS_ENOTCONN;
+    if (!mref_reader.is_state_satisfied()) {
+      int64_t rc = -CEPHFS_ENOTCONN;
+      if (onfinish != nullptr) {
+        onfinish->complete(rc);
+        /* async call should always return zero to caller and allow the
+        caller to wait on callback for the actual errno. */
+        rc = 0;
+      }
+      return rc;
+    }
 
     std::scoped_lock cl(client_lock);
     return _preadv_pwritev_locked(fh, iov, iovcnt, offset, write, true,
                                  onfinish, bl, do_fsync, syncdataonly);
+
 }
 
 int Client::ll_flush(Fh *fh)