dm-buffered: rework spinlocks Change spin_lock_irq to spin_lock because we don't lock the spinlock in an irq. Grab the spinlock when calling bio_list_empty. Signed-off-by: Mikulas Patocka --- drivers/md/dm-buffered-target.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) Index: linux-2.6/drivers/md/dm-buffered-target.c =================================================================== --- linux-2.6.orig/drivers/md/dm-buffered-target.c +++ linux-2.6/drivers/md/dm-buffered-target.c @@ -271,12 +271,12 @@ static void _process_bio(struct work_str { struct buffered_c *bc = container_of(work, struct buffered_c, buffered_ws); struct bio *bio; - bool write; + bool write, queue; sector_t blocks, start, end; - spin_lock_irq(&bc->lock); + spin_lock(&bc->lock); bio = bio_list_pop(&bc->bios); - spin_unlock_irq(&bc->lock); + spin_unlock(&bc->lock); if (!bio) return; @@ -309,11 +309,16 @@ static void _process_bio(struct work_str write = true; break; default: + break; } __process_bio(bc, bio); - if (!bio_list_empty(&bc->bios)) + spin_lock(&bc->lock); + queue = !bio_list_empty(&bc->bios); + spin_unlock(&bc->lock); + + if (queue) queue_work(bc->buffered_wq, &bc->buffered_ws); /* Reschedule the flush thread in case of new write(s) */ @@ -479,10 +484,10 @@ static int buffered_map(struct dm_target bio->bi_iter.bi_sector = dm_target_offset(ti, bio->bi_iter.bi_sector); - spin_lock_irq(&bc->lock); + spin_lock(&bc->lock); queue = bio_list_empty(&bc->bios); bio_list_add(&bc->bios, bio); - spin_unlock_irq(&bc->lock); + spin_unlock(&bc->lock); if (queue) queue_work(bc->buffered_wq, &bc->buffered_ws);