Bug 860338

Summary: Cannot activate volume group that is on a read-only disk
Product: Red Hat Enterprise Linux 6 Reporter: Leland Lucius <redhat>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2CC: agk, dwysocha, heinzm, herrold, jbrassow, msnitzer, nperic, prajnoha, prockai, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.98-2.el6 Doc Type: Bug Fix
Doc Text:
If physical volumes are on read-only disks, then vgchange -ay will produce an error like this and fail to activate any Logical Volumes despite what the message says: /dev/dasdf1: open failed: Read-only file system device-mapper: reload ioctl failed: Invalid argument 1 logical volume(s) in volume group "v-9c0ed7a0-1271-452a-9342-60dacafe5d17" now active This is fixed. The bug was present since upstream version 2.02.84.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 08:13:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Leland Lucius 2012-09-25 16:18:07 UTC
Description of problem:

There is a bug in LVM that appears somewhere around version 2.02.84 (2.02.83 works fine) and is fixed in 2.02.97. All versions between those two suffer from this bug. Here is how it manifests itself: if the physical volumes are on read only disks, then vgchange will produce this error:

[root@QAGrid04 ~]# vgchange -ay
/dev/dasdf1: open failed: Read-only file system
/dev/dasdf1: open failed: Read-only file system
device-mapper: reload ioctl failed: Invalid argument
1 logical volume(s) in volume group "v-9c0ed7a0-1271-452a-9342-60dacafe5d17" now active

And the volumegroup is not activated (despite what the messages said).

The cause of the bug is a change in architecture, where lib/device/dev-io.c has a function called dev_open which was later split into dev_open and dev_open_readonly. Looks like someone forgot to change dev_open to dev_open_readonly in _dev_read_ahead_dev which is the cause of this bug. The 2.02.97 version has the call changed to dev_open_readonly.

Version-Release number of selected component (if applicable):

lvm2-2.02.87-6.el6

How reproducible:

Every time.

Steps to Reproduce:
1.  Create a volume group
2.  Make the media read-only
3.  Attempt to activate the volume group
  
Actual results:

See above

Expected results:

The volume group should be activated.

Additional info:

Comment 2 R P Herrold 2012-09-25 16:35:27 UTC
This probably represents a "regression" and loss of prior functionality, in that it is a loss of function, compared to the LVM2 that shipped earlier in the RHEL 6 lifecycle

Comment 3 R P Herrold 2012-10-23 14:39:35 UTC
I see http://rhn.redhat.com/errata/RHBA-2012-1399.html issued today, without this regression fix.  Any change of getting it slated into the 6.4 update cycle?

-- Russ herrold

Comment 4 Alasdair Kergon 2012-10-23 14:59:11 UTC
6.4 is based upon 2.02.98, so this fix should already be included.

Comment 6 Nenad Peric 2012-10-26 12:51:58 UTC
Checked the VG activation with a write protect on one of the disks.
No errors issued, and VG was activated:



sd 10:0:0:1: [sdb] Write Protect is on
(07:43:14) [root@r6-node01:~]$ lvs
  LV        VG       Attr      LSize Pool Origin Data%  Move Log Copy%  Convert
  lv_root   VolGroup -wi-ao--- 7.54g                                           
  lv_swap   VolGroup -wi-ao--- 1.97g                                           
  mylv      vg_one   -wi------ 2.00g                                           
  second_lv vg_one   -wi------ 5.00g                                           
(07:44:00) [root@r6-node01:~]$ pvs
  PV         VG       Fmt  Attr PSize PFree
  /dev/sda1  vg_one   lvm2 a--  9.99g 7.99g
  /dev/sdb1  vg_one   lvm2 a--  9.99g 4.99g
  /dev/vda2  VolGroup lvm2 a--  9.51g    0 
(07:44:00) [root@r6-node01:~]$ vgchange -ay vg_one
  2 logical volume(s) in volume group "vg_one" now active
(07:44:11) [root@r6-node01:~]$ lvs -a -o +devices
  LV        VG       Attr      LSize Pool Origin Data%  Move Log Copy%  Convert Devices        
  lv_root   VolGroup -wi-ao--- 7.54g                                            /dev/vda2(0)   
  lv_swap   VolGroup -wi-ao--- 1.97g                                            /dev/vda2(1930)
  mylv      vg_one   -wi-a---- 2.00g                                            /dev/sda1(0)   
  second_lv vg_one   -wi-a---- 5.00g                                            /dev/sdb1(0)   


Tested with:

lvm2-2.02.98-2.el6.x86_64
lvm2-libs-2.02.98-2.el6.x86_64
kernel-2.6.32-335.el6.x86_64

Comment 8 Nenad Peric 2012-10-26 13:01:00 UTC
Marking as verified based on my previous comment :)

Comment 9 errata-xmlrpc 2013-02-21 08:13:55 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-2013-0501.html