dm: fix opening log and cow devices for read only tables
If a table is read-only, also open any log and cow devices it uses read-only. Previously, even read-only devices were opened read-write internally. After patch75f1dc0d07
block: check bdev_read_only() from blkdev_get() was applied, loading such tables began to fail. The patch was reverted bye51900f7d3
block: revert block_dev read-only check but this patch fixes this part of the code to work with the original patch. Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
parent
4bbba111d9
commit
024d37e95e
|
@ -543,7 +543,7 @@ static int disk_ctr(struct dm_dirty_log *log, struct dm_target *ti,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = dm_get_device(ti, argv[0], FMODE_READ | FMODE_WRITE, &dev);
|
r = dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &dev);
|
||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
|
|
||||||
r = dm_get_device(ti, cow_path, FMODE_READ | FMODE_WRITE, &s->cow);
|
r = dm_get_device(ti, cow_path, dm_table_get_mode(ti->table), &s->cow);
|
||||||
if (r) {
|
if (r) {
|
||||||
ti->error = "Cannot get COW device";
|
ti->error = "Cannot get COW device";
|
||||||
goto bad_cow;
|
goto bad_cow;
|
||||||
|
|
Loading…
Reference in New Issue