1 From: Nikanth Karthikesan <knikanth@suse.de>
2 Subject: Release md->map_lock before set_disk_ro
6 Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
8 Calling set_disk_ro() with irqs disabled triggers a warning.
10 set_disk_ro() can be called outside the
11 write_lock_irqsave(&md->map_lock)? And to get the
12 dm_table_get_mode(md->map), we just need to hold a reference
13 with dm_get_table() and dm_table_put()
16 Index: linux-2.6.27-SLE11_BRANCH/drivers/md/dm.c
17 ===================================================================
18 --- linux-2.6.27-SLE11_BRANCH.orig/drivers/md/dm.c
19 +++ linux-2.6.27-SLE11_BRANCH/drivers/md/dm.c
20 @@ -1948,12 +1948,15 @@ static int __bind(struct mapped_device *
22 dm_table_set_restrictions(t, q);
23 dm_table_set_integrity(t, md);
24 - if (!(dm_table_get_mode(t) & FMODE_WRITE)) {
25 - set_disk_ro(md->disk, 1);
27 + write_unlock_irqrestore(&md->map_lock, flags);
30 + if (dm_table_get_mode(md->map) & FMODE_WRITE) {
31 set_disk_ro(md->disk, 0);
33 + set_disk_ro(md->disk, 1);
35 - write_unlock_irqrestore(&md->map_lock, flags);
36 + dm_table_put(md->map);