Skip to content

Commit

Permalink
bdev: propagate child I/O error for split I/O
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Savitskiy <[email protected]>
  • Loading branch information
dsavitskiy committed Jul 24, 2024
1 parent f6fcf36 commit df6caca
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/bdev/bdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,17 @@ bdev_io_complete_parent_sequence_cb(void *ctx, int status)
parent_bdev_io_complete(bdev_io, status);
}

/*
* Determines if bdev_io has no space error status.
*/
static bool
_is_no_space_error(struct spdk_bdev_io *bdev_io)
{
return bdev_io->internal.status == SPDK_BDEV_IO_STATUS_NVME_ERROR &&
bdev_io->internal.error.nvme.sct == SPDK_NVME_SCT_VENDOR_SPECIFIC &&
bdev_io->internal.error.nvme.sc == ENOSPC;
}

static void
bdev_io_split_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
{
Expand All @@ -3342,7 +3353,17 @@ bdev_io_split_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
spdk_bdev_free_io(bdev_io);

if (!success) {
parent_io->internal.status = SPDK_BDEV_IO_STATUS_FAILED;
/*
* Propagate the last child error, unless it is ENOSPC.
* ENOSPC takes lower precedence because it may hide
* a more important failure.
*/
if (parent_io->internal.status == SPDK_BDEV_IO_STATUS_SUCCESS ||
!_is_no_space_error(bdev_io)) {
parent_io->internal.status = bdev_io->internal.status;
parent_io->internal.error = bdev_io->internal.error;
}

/* If any child I/O failed, stop further splitting process. */
parent_io->u.bdev.split_current_offset_blocks += parent_io->u.bdev.split_remaining_num_blocks;
parent_io->u.bdev.split_remaining_num_blocks = 0;
Expand Down

0 comments on commit df6caca

Please sign in to comment.