+ // NOTE: Possible race condition between blkio_commit and pwait.
+ // Consider: what if scheduler complete the request before pwait even get
+ // called?
+ // Two possible work around:
+ // #1. we disable the interrupt before schedule the request.
+ // #2. we do scheduling within interrupt context (e.g., attach a timer)
+ // As we don't want to overwhelming the interrupt context and also keep the
+ // request RTT as small as possible, hence #1 is preferred.
+
+ /*
+ FIXME
+ Potential racing here.
+ happened when blkio is committed at high volumn, while the
+ block device has very little latency.
+ This is particular serious for non-async blkio, it could
+ completed before we do pwait, causing the thread hanged indefinitely
+ */
+
+ if (blkio_stalled(ctx)) {
+ if ((options & BLKIO_WAIT)) {
+ blkio_schedule(ctx);
+ try_wait_check_stall();
+ return;
+ }