From: Nikanth Karthikesan Subject: Release md->map_lock before set_disk_ro Patch-mainline: No References: bnc#479784 Signed-off-by: Nikanth Karthikesan Calling set_disk_ro() with irqs disabled triggers a warning. set_disk_ro() can be called outside the write_lock_irqsave(&md->map_lock)? And to get the dm_table_get_mode(md->map), we just need to hold a reference with dm_get_table() and dm_table_put() Index: linux-2.6.27-SLE11_BRANCH/drivers/md/dm.c =================================================================== --- linux-2.6.27-SLE11_BRANCH.orig/drivers/md/dm.c +++ linux-2.6.27-SLE11_BRANCH/drivers/md/dm.c @@ -1948,12 +1948,15 @@ static int __bind(struct mapped_device * md->map = t; dm_table_set_restrictions(t, q); dm_table_set_integrity(t, md); - if (!(dm_table_get_mode(t) & FMODE_WRITE)) { - set_disk_ro(md->disk, 1); - } else { + write_unlock_irqrestore(&md->map_lock, flags); + + dm_get_table(md); + if (dm_table_get_mode(md->map) & FMODE_WRITE) { set_disk_ro(md->disk, 0); + } else { + set_disk_ro(md->disk, 1); } - write_unlock_irqrestore(&md->map_lock, flags); + dm_table_put(md->map); return 0; }