You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qubes-linux-kernel/patches.fixes/dm-release-map_lock-before-...

38 lines
1021 B

From: Nikanth Karthikesan <knikanth@suse.de>
Subject: Release md->map_lock before set_disk_ro
Patch-mainline: No
References: bnc#556899 bnc#479784
Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
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(-)
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2174,12 +2174,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;
}