]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.suse/dm-table-change-mode-to-ro
Updated xen patches taken from suse.
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.suse / dm-table-change-mode-to-ro
1 From: Hannes Reinecke <hare@suse.de>
2 Subject: Switch device-mapper tables to READ-WRITE
3 References: bnc#440959
4
5 Switching a device-mapper table to READ-ONLY works quite well, but
6 we can't switch back to READ-WRITE as this change will be masked out.
7 So get rid of this masking and use the flags directly.
8 And implement a fallback to automatically switch to read-only.
9
10 Signed-off-by: Hannes Reinecke <hare@suse.de>
11
12 --- linux-2.6.27/drivers/md/dm-table.c.orig 2009-02-02 13:09:06.000000000 +0100
13 +++ linux-2.6.27/drivers/md/dm-table.c 2009-02-02 14:03:03.000000000 +0100
14 @@ -423,9 +423,13 @@ static int upgrade_mode(struct dm_dev *d
15
16 dd_copy = *dd;
17
18 - dd->mode |= new_mode;
19 + dd->mode = new_mode;
20 dd->bdev = NULL;
21 r = open_dev(dd, dev, md);
22 + if (r == -EROFS) {
23 + dd->mode &= ~FMODE_WRITE;
24 + r = open_dev(dd, dev, md);
25 + }
26 if (!r)
27 close_dev(&dd_copy, md);
28 else
29 @@ -487,7 +491,7 @@ static int __table_get_device(struct dm_
30 atomic_set(&dd->count, 0);
31 list_add(&dd->list, &t->devices);
32
33 - } else if (dd->mode != (mode | dd->mode)) {
34 + } else if (dd->mode != mode) {
35 r = upgrade_mode(dd, mode, t->md);
36 if (r)
37 return r;