Project

General

Profile

Actions

Bug #82191

open
KB

blk/spdk: an NVMe I/O error asserts in io_complete(), and the last aio completion uses a freed IOContext

Bug #82191: blk/spdk: an NVMe I/O error asserts in io_complete(), and the last aio completion uses a freed IOContext

Added by Kyle Bader about 1 month ago. Updated about 1 month ago.

Status:
Fix Under Review
Priority:
Normal
Assignee:
-
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

With the SPDK block device (NVMEDevice), io_complete() asserts that
every NVMe completion succeeded:

ceph_assert(!spdk_nvme_cpl_is_error(completion));

It does this for reads, writes and flushes. A media error on the NVMe
device therefore stops the OSD. KernelDevice instead returns -EIO, and
fails an IOContext that allows EIO.

The same function also has a use-after-free. The last aio completion of
an IOContext calls aio_callback(), and that callback can free the
IOContext. After the callback, a write still releases its buffers, and
_aio_handle() still reads ioc->num_running.

Fix

  • read() returns -EIO, and an aio completion with an error fails an
    IOContext that allows EIO, as KernelDevice does.
  • Nothing uses the IOContext after the last aio callback.

No automated test covers this path, because it needs an NVMe device
bound to SPDK.

Affected versions: main

KB Updated by Kyle Bader about 1 month ago Actions #1

  • Pull request ID set to 73172

AK Updated by Adam Kupczyk about 1 month ago Actions #2

  • Status changed from New to Fix Under Review
Actions

Also available in: PDF Atom