Skip to content

Commit

Permalink
nbd: clear last_sqe's SQE_LINK after the staggered ios are queued
Browse files Browse the repository at this point in the history
If staggered ios in next sqe chain are just queued inside
nbd_handle_io_bg() because current sqe chain are completed, we have
to clear the last sqe's SQE_LINK after the whole next sqe chain is
queued.

Fix one io hang issue, which is often triggered when running 512k bs
IO with localhost nbd server. And not easy to reproduce with remote
nbd server.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
  • Loading branch information
ming1 committed Jan 14, 2023
1 parent 40c9e10 commit 175ffd1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions nbd/tgt_nbd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,6 @@ static void nbd_handle_send_bg(const struct ublksrv_queue *q,
if (q_data->send_sqe_chain_busy && !q_data->chained_send_ios)
q_data->send_sqe_chain_busy = 0;

if (q_data->last_send_sqe) {
q_data->last_send_sqe->flags &= ~IOSQE_IO_LINK;
q_data->last_send_sqe = NULL;
}

if (!q_data->send_sqe_chain_busy) {
std::vector<const struct ublk_io_data *> &ios =
q_data->next_chain;
Expand All @@ -648,6 +643,10 @@ static void nbd_handle_send_bg(const struct ublksrv_queue *q,
if (q_data->chained_send_ios && !q_data->send_sqe_chain_busy)
q_data->send_sqe_chain_busy = 1;
}
if (q_data->last_send_sqe) {
q_data->last_send_sqe->flags &= ~IOSQE_IO_LINK;
q_data->last_send_sqe = NULL;
}
}

static void nbd_recv_reply(const struct ublksrv_queue *q)
Expand Down

0 comments on commit 175ffd1

Please sign in to comment.