RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 769293 - Provide a way for read-write LVs to be activated read-only without updating their metadata.
Summary: Provide a way for read-write LVs to be activated read-only without updating t...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Alasdair Kergon
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-20 13:14 UTC by Federico Simoncelli
Modified: 2012-06-20 15:00 UTC (History)
12 users (show)

Fixed In Version: lvm2-2.02.95-1.el6
Doc Type: Enhancement
Doc Text:
Activating volumes in a read-only mode A new LVM configuration file parameter, activation/read_only_volume_list, makes it possible to activate particular volumes always in a read-only mode, regardless of the actual permissions on the volumes concerned. This parameter overrides the --permission rw option stored in the metadata.
Clone Of:
Environment:
Last Closed: 2012-06-20 15:00:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0962 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2012-06-19 21:12:11 UTC

Comment 6 Alasdair Kergon 2012-01-12 17:12:01 UTC
Federico has implemented this using the activation filter method and I've committed this upstream to be picked up in the 6.3 build.

  Add activation/read_only_volume_list to override LV permission in metadata.
  Use R lv_attr to indicate read-only activation of non-read-only device in lvs.
  Show read-only activation override in lvdisplay & add 4 to perms in -c.

It works just like the existing volume_list filter.

    # If read_only_volume_list is defined, each LV that is to be activated 
    # is checked against the list, and if it matches, it as activated
    # in read-only mode.  (This overrides '--permission rw' stored in the
    # metadata.)
    #   "vgname" and "vgname/lvname" are matched exactly.
    #   "@tag" matches any tag set in the LV or VG.
    #   "@*" matches if any tag defined on the host is also set in the LV or VG
    #
    # read_only_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]

So RHEV can use an override in --config when it needs a RW volume to be activated read-only temporarily.

Comment 8 Alasdair Kergon 2012-01-12 17:27:54 UTC
Scope of change:

- Create normal LVs with lvcreate.

- Toggle read/write state with lvchange -pr or -prw.

- Activate/deactivate with lvchange -ay or -an.

- Add/remove activation/read_only_volume_list in lvm.conf with values that match or don't match some LVs.

- After a change to lvm.conf, run lvchange --refresh for it to take effect on already-active LVs.

- Check whether LVs are read-only or read-write with dmsetup info -c (w or r) and lvdisplay, lvdisplay -c, lvs as below.


If the new lvm.conf setting is not present, or if it is present and does not match the LV, the LV is activated with the read-only or read-write permissions stored in the metadata.  (Note that if the VG metadata permission is set to 'read only' then all LVs in it are treated as 'read-only' for activation purposes regardless of whether they might individually say they are 'read-write'.)

If the new lvm.conf setting is present and matches an LV, when that LV is activated it will be activated read-only.

Any read/write LV activated read-only is shown as follows:

lvdisplay uses "read/write (activated read only)".

lvdisplay -c adds '4' to the number in the permissions field.

lvs places 'R' in the 2nd char of the lv_attr field.

Comment 10 Alasdair Kergon 2012-04-26 00:50:01 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
A new LVM configuration file setting, activation/read_only_volume_list, makes it possible always to activate particular volumes read-only, regardless of the actual permissions on the volumes concerned.

Comment 11 Martin Prpič 2012-05-02 13:32:33 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1,3 @@
-A new LVM configuration file setting, activation/read_only_volume_list, makes it possible always to activate particular volumes read-only, regardless of the actual permissions on the volumes concerned.+Activating volumes in the read-only mode
+
+A new LVM configuration file parameter, activation/read_only_volume_list, makes it possible to always activate particular volumes in the read-only mode, regardless of the actual permissions on the volumes concerned. This parameter overrides the --permission rw option stored in the metadata.

Comment 12 Alasdair Kergon 2012-05-02 14:49:20 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,3 +1,3 @@
 Activating volumes in the read-only mode
 
-A new LVM configuration file parameter, activation/read_only_volume_list, makes it possible to always activate particular volumes in the read-only mode, regardless of the actual permissions on the volumes concerned. This parameter overrides the --permission rw option stored in the metadata.+A new LVM configuration file parameter, activation/read_only_volume_list, makes it possible to activate particular volumes always in a read-only mode, regardless of the actual permissions on the volumes concerned. This parameter overrides the --permission rw option stored in the metadata.

Comment 13 Alasdair Kergon 2012-05-02 15:02:00 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,3 +1,3 @@
-Activating volumes in the read-only mode
+Activating volumes in a read-only mode
 
 A new LVM configuration file parameter, activation/read_only_volume_list, makes it possible to activate particular volumes always in a read-only mode, regardless of the actual permissions on the volumes concerned. This parameter overrides the --permission rw option stored in the metadata.

Comment 14 Corey Marthaler 2012-05-14 23:01:07 UTC
Feature verified in the latest rpms. With the option set in lvm.conf, nothing can be done on the cmdline to overide it.

lvm.conf:
    read_only_volume_list = [ "vg1/lv1" ]


[root@hayes-01 ~]# vgcreate vg1 /dev/etherd/e1.1p*
  Volume group "vg1" successfully created
[root@hayes-01 ~]# lvcreate -n lv1 -L 100M vg1
  /dev/vg1/lv1: write failed after 0 of 4096 at 0: Operation not permitted
  Logical volume "lv1" created
[root@hayes-01 ~]# lvs -a -o +devices
  LV      VG         Attr     LSize   Devices              
  lv1     vg1        -Ri-a--- 100.00m /dev/etherd/e1.1p1(0)

[root@hayes-01 ~]# lvchange -p rw vg1/lv1
  Logical volume "lv1" is already writable

[root@hayes-01 ~]# lvs -a -o +devices
  LV      VG         Attr     LSize   Devices              
  lv1     vg1        -Ri-a--- 100.00m /dev/etherd/e1.1p1(0)

[root@hayes-01 ~]# dmsetup info
Name:              vg1-lv1
State:             ACTIVE (READ-ONLY)
Read Ahead:        256
Tables present:    LIVE
Open count:        0
Event number:      0
Major, minor:      253, 3
Number of targets: 1
UUID: LVM-MZ1ApP1AtdfOSg18MOKka9DGQJlTUa0ApR0Vl9yAYEzJVV0GRqLmKU4rJj1AaoRm

[root@hayes-01 ~]# dd if=/dev/zero of=/dev/vg1/lv1 count=1
dd: writing to `/dev/vg1/lv1': Operation not permitted
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.00034238 s, 0.0 kB/s


2.6.32-269.el6.x86_64
lvm2-2.02.95-8.el6    BUILT: Wed May  9 03:33:32 CDT 2012
lvm2-libs-2.02.95-8.el6    BUILT: Wed May  9 03:33:32 CDT 2012
lvm2-cluster-2.02.95-8.el6    BUILT: Wed May  9 03:33:32 CDT 2012
udev-147-2.41.el6    BUILT: Thu Mar  1 13:01:08 CST 2012
device-mapper-1.02.74-8.el6    BUILT: Wed May  9 03:33:32 CDT 2012
device-mapper-libs-1.02.74-8.el6    BUILT: Wed May  9 03:33:32 CDT 2012
device-mapper-event-1.02.74-8.el6    BUILT: Wed May  9 03:33:32 CDT 2012
device-mapper-event-libs-1.02.74-8.el6    BUILT: Wed May  9 03:33:32 CDT 2012
cmirror-2.02.95-8.el6    BUILT: Wed May  9 03:33:32 CDT 2012

Comment 16 errata-xmlrpc 2012-06-20 15:00:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0962.html


Note You need to log in before you can comment on or make changes to this bug.