]> exis.tech > repos - linux.git/blobdiff - block/blk-mq.c
Merge tag 'hwmon-for-v7.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groec...
[linux.git] / block / blk-mq.c
index 88cb5acc4f39e9c9a7412de72c5ab31a58113640..2c850330a32bc6b0ba1bc7cbe3a3597ef76762cf 100644 (file)
@@ -5218,6 +5218,7 @@ static int blk_hctx_poll(struct request_queue *q, struct blk_mq_hw_ctx *hctx,
                         struct io_comp_batch *iob, unsigned int flags)
 {
        int ret;
+       unsigned long timeout = jiffies + 2;
 
        do {
                ret = q->mq_ops->poll(hctx, iob);
@@ -5228,7 +5229,7 @@ static int blk_hctx_poll(struct request_queue *q, struct blk_mq_hw_ctx *hctx,
                if (ret < 0 || (flags & BLK_POLL_ONESHOT))
                        break;
                cpu_relax();
-       } while (!need_resched());
+       } while (!need_resched() && time_before(jiffies, timeout));
 
        return 0;
 }