summaryrefslogtreecommitdiffstats
path: root/src/librbd/migration/NBDStream.cc
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2024-09-02 22:14:27 +0200
committerIlya Dryomov <idryomov@gmail.com>2024-09-06 14:14:12 +0200
commitd6d308003b2c291f28c0c9defd4895c76137f89c (patch)
tree1893b16852ff60f86a09ba4a615ea0ec8ab259bd /src/librbd/migration/NBDStream.cc
parentlibrbd/migration/NBDStream: introduce from_nbd_errno() (diff)
downloadceph-d6d308003b2c291f28c0c9defd4895c76137f89c.tar.xz
ceph-d6d308003b2c291f28c0c9defd4895c76137f89c.zip
librbd/migration/NBDStream: check for nbd_get_size() errors
nbd_get_size() can fail with EOVERFLOW and possibly other errors. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to '')
-rw-r--r--src/librbd/migration/NBDStream.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/librbd/migration/NBDStream.cc b/src/librbd/migration/NBDStream.cc
index 2513f156efd..b4d30206c63 100644
--- a/src/librbd/migration/NBDStream.cc
+++ b/src/librbd/migration/NBDStream.cc
@@ -277,7 +277,16 @@ template <typename I>
void NBDStream<I>::get_size(uint64_t* size, Context* on_finish) {
ldout(m_cct, 20) << dendl;
- *size = nbd_get_size(m_nbd);
+ int64_t rc = nbd_get_size(m_nbd);
+ if (rc == -1) {
+ rc = nbd_get_errno();
+ lderr(m_cct) << "get_size: " << nbd_get_error()
+ << " (errno = " << rc << ")" << dendl;
+ on_finish->complete(from_nbd_errno(rc));
+ return;
+ }
+
+ *size = rc;
on_finish->complete(0);
}