dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* kpartx ignores read-only?
@ 2013-10-19 21:19 Andreas Klauer
  0 siblings, 0 replies; only message in thread
From: Andreas Klauer @ 2013-10-19 21:19 UTC (permalink / raw)
  To: dm-devel

Hi,

on my system I have some read-only device mapper targets. They are 
old LVM instances which I made read-only using (lvchange -p r LV) 
in order to preserve their contents.

One of them contains a partitioned hard disk image.

# dmsetup info /dev/dm-29
> Name:              HDD-OLD--rost--image
> State:             ACTIVE (READ-ONLY)
> Read Ahead:        12288
> Tables present:    LIVE
> Open count:        1
> Event number:      0
> Major, minor:      253, 29
> Number of targets: 1
> UUID: LVM-PGTIP3IjFCE4UHM9fFGxuVhKR4FmCXO0gwvX8HW6JBs2dfxj6lYyKOmDLyxsDf0B

In order to mount a few partitions of it, I used kpartx to map the partitions.

# kpartx -a /dev/dm-29

This works fine, except the READ-ONLY does not seem to stick.

# dmsetup ls --tree
> [...]
> HDD-OLD--rost--imagep1 (253:30)
>  └─HDD-OLD--rost--image (253:29)
> [...]

# dmsetup info /dev/mapper/HDD-OLD--rost--imagep1
> Name:              HDD-OLD--rost--imagep1
> State:             ACTIVE
> Read Ahead:        256
> Tables present:    LIVE
> Open count:        0
> Event number:      0
> Major, minor:      253, 30
> Number of targets: 1
> UUID: part1-LVM-PGTIP3IjFCE4UHM9fFGxuVhKR4FmCXO0gwvX8HW6JBs2dfxj6lYyKOmDLyxsDf0B

And it's completely writable.

I tried to use losetup --partscan as an alternative to kpartx, which kind 
of works, except the kernel believes the loop device to be writable and 
gives a lot of I/O error messages and the filesystem behaves oddly.

> [ 3136.455451] Buffer I/O error on device loop0p1, logical block 1568
> [ 3136.455454] lost page write due to I/O error on loop0p1
> [ 3136.455466] loop: Write error at byte offset 36003840, length 4096.
> [ 3136.455469] Buffer I/O error on device loop0p1, logical block 8534
> [ 3136.455472] lost page write due to I/O error on loop0p1
> [ 3136.455478] loop: Write error at byte offset 5094449152, length 4096.
> [...]

This doesn't happen for other read-only devices (such as /dev/cdrom).

I can work around it using losetup --read-only, just wondering if this is 
expected behaviour at all or not? I never used read-only dm/LV before, 
but my expectation was that the read-only property in one place would 
also affect all devices that derive from it...

I'm using kernel 3.11.4 if it makes any difference.

Regards
Andreas Klauer

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-19 21:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-19 21:19 kpartx ignores read-only? Andreas Klauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).