]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
blk/kernel: Fix error code mapping in KernelDevice::read. 48467/head
authorJoshua Baergen <jbaergen@digitalocean.com>
Wed, 12 Oct 2022 18:19:36 +0000 (12:19 -0600)
committerJoshua Baergen <jbaergen@digitalocean.com>
Wed, 12 Oct 2022 19:36:36 +0000 (13:36 -0600)
pread returns -1 upon error and stores the error code in errno, and thus
the wrong error was being passed into is_expected_ioerr. This is handled
correctly just a few lines down where we return -errno, so it was likely
just an oversight when adapting this logic from the aio codepath, where
the return code is indeed the errno.

This logic has been incorrect since it was introduced in 2018 via
a1e0ece7f987c7a563b25ec0d02fc6f8445ef54e.

Signed-off-by: Joshua Baergen <jbaergen@digitalocean.com>
src/blk/kernel/KernelDevice.cc

index d9c1e529c071c17b91dd2e3bf224c91063ee44ed..14b5b415385adb6287160434bd4a1168da38e2ff 100644 (file)
@@ -1229,7 +1229,7 @@ int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
         << "s" << dendl;
   }
   if (r < 0) {
-    if (ioc->allow_eio && is_expected_ioerr(r)) {
+    if (ioc->allow_eio && is_expected_ioerr(-errno)) {
       r = -EIO;
     } else {
       r = -errno;