diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-lib.c | 8 | ||||
-rw-r--r-- | block/blk.h | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c index d6f50d572565..9a32f5868fb9 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -121,6 +121,14 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, atomic_inc(&bb.done); submit_bio(type, bio); + + /* + * We can loop for a long time in here, if someone does + * full device discards (like mkfs). Be nice and allow + * us to schedule out to avoid softlocking if preempt + * is disabled. + */ + cond_resched(); } blk_finish_plug(&plug); diff --git a/block/blk.h b/block/blk.h index e837b8f619b7..b3bdeb36f361 100644 --- a/block/blk.h +++ b/block/blk.h @@ -96,7 +96,7 @@ static inline struct request *__elv_next_request(struct request_queue *q) q->flush_queue_delayed = 1; return NULL; } - if (unlikely(blk_queue_dying(q)) || + if (unlikely(blk_queue_bypass(q)) || !q->elevator->type->ops.elevator_dispatch_fn(q, 0)) return NULL; } |