From: Nikanth Karthikesan Subject: Release md->map_lock before set_disk_ro Patch-mainline: No References: bnc#556899 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() --- drivers/md/dm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Index: linux-2.6.33-master/drivers/md/dm.c =================================================================== --- linux-2.6.33-master.orig/drivers/md/dm.c +++ linux-2.6.33-master/drivers/md/dm.c @@ -2102,12 +2102,15 @@ static struct dm_table *__bind(struct ma old_map = md->map; md->map = t; dm_table_set_restrictions(t, q, limits); + write_unlock_irqrestore(&md->map_lock, flags); + + dm_table_get(md->map); if (!(dm_table_get_mode(t) & FMODE_WRITE)) { set_disk_ro(md->disk, 1); } else { set_disk_ro(md->disk, 0); } - write_unlock_irqrestore(&md->map_lock, flags); + dm_table_put(md->map); return old_map; }