spin_lock(&ubq->cancel_lock);
for (j = 0; j < ubq->q_depth; j++)
ubq->ios[j].flags &= ~UBLK_IO_FLAG_CANCELED;
+ ubq->canceling = false;
spin_unlock(&ubq->cancel_lock);
ubq->fail_io = false;
- ubq->canceling = false;
}
/* device can only be started after all IOs are ready */
/*
* If queue was ready before this decrement, it won't be anymore,
- * so we need to decrement the queue ready count too.
+ * so we need to decrement the queue ready count and restore the
+ * canceling flag to prevent new requests from being queued.
*/
- if (ublk_queue_ready(ubq))
+ if (ublk_queue_ready(ubq)) {
data->ub->nr_queue_ready--;
+ spin_lock(&ubq->cancel_lock);
+ ubq->canceling = true;
+ spin_unlock(&ubq->cancel_lock);
+ }
ubq->nr_io_ready--;
ublk_io_lock(io);