Message ID | 1393872955-28810-59-git-send-email-kamal@canonical.com |
---|---|
State | New |
Headers | show |
diff --git a/block/blk-lib.c b/block/blk-lib.c index b3a1f2b7..016833c 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);