Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1348343

Summary: used nomda PV is missing the 'u' attribute in the pv_attr
Product: Red Hat Enterprise Linux 7 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: LVM and device-mapper development team <lvm-team>
lvm2 sub component: Displaying and Reporting QA Contact: cluster-qe <cluster-qe>
Status: CLOSED NOTABUG Docs Contact:
Severity: low    
Priority: unspecified CC: agk, heinzm, jbrassow, msnitzer, prajnoha, prockai, zkabelac
Version: 7.3   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-21 08:50:52 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 Corey Marthaler 2016-06-20 22:08:30 UTC
Description of problem:
This is a reg check for bug 800012. It appears that everything but the attr was updated. Should be 'a-u' not 'a--'.


SCENARIO - [create_thin_snap_wo_meta_area_accidental_use_check]
Create thin snapshot on PV w/o any metadata space, then check that PV is protected from accidental use (bug 800012)

Recreating VG with two devices, one w/ mda and one w/o
Recreating /dev/sdg1 *without* any metadata space
Recreating /dev/sdb1 *with* metadata space

Creating thin pool solely on device w/o MDA
lvcreate  --thinpool no_mda -L 1G --poolmetadatasize 4M snapper_thinp /dev/sdg1

lvcreate  --virtualsize 250M -T snapper_thinp/no_mda -n origin
lvcreate  -V 250M -T snapper_thinp/no_mda -n other1
lvcreate  -V 250M -T snapper_thinp/no_mda -n other2
lvcreate  -V 250M -T snapper_thinp/no_mda -n other3
lvcreate  -V 250M -T snapper_thinp/no_mda -n other4
  WARNING: Sum of all thin volume sizes (1.23 GiB) exceeds the size of thin pool snapper_thinp/no_mda (1.00 GiB)!
lvcreate  --virtualsize 250M -T snapper_thinp/no_mda -n other5
  WARNING: Sum of all thin volume sizes (1.48 GiB) exceeds the size of thin pool snapper_thinp/no_mda (1.00 GiB)!

Creating snap of origin
lvcreate  -k n -s /dev/snapper_thinp/origin -n snap_on_vg_wo_meta_area

check for proper pvs settings for pv_attr,pv_in_use,pv_ext_vsn for /dev/sdg1
pvs should be active and in use


[root@host-083 ~]# lvs -a -o +devices
  LV                      VG            Attr       LSize   Pool   Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices        
  [lvol0_pmspare]         snapper_thinp ewi-------   4.00m                                                       /dev/sdg1(0)   
  no_mda                  snapper_thinp twi---tz--   1.00g                                                       no_mda_tdata(0)
  [no_mda_tdata]          snapper_thinp Twi-------   1.00g                                                       /dev/sdg1(1)   
  [no_mda_tmeta]          snapper_thinp ewi-------   4.00m                                                       /dev/sdg1(257) 
  origin                  snapper_thinp Vwi---tz-- 252.00m no_mda                                                               
  other1                  snapper_thinp Vwi---tz-- 252.00m no_mda                                                               
  other2                  snapper_thinp Vwi---tz-- 252.00m no_mda                                                               
  other3                  snapper_thinp Vwi---tz-- 252.00m no_mda                                                               
  other4                  snapper_thinp Vwi---tz-- 252.00m no_mda                                                               
  other5                  snapper_thinp Vwi---tz-- 252.00m no_mda                                                               
  snap_on_vg_wo_meta_area snapper_thinp Vwi---tz-- 252.00m no_mda origin                                                        


[root@host-083 ~]# pvs -o pv_name,pv_attr,pv_ext_vsn,pv_in_use,pv_used /dev/sdg1
  PV         Attr PExtVsn PInUse Used
  /dev/sdg1  a--        2   used 1.01g


Version-Release number of selected component (if applicable):
3.10.0-419.el7.x86_64

lvm2-2.02.156-1.el7    BUILT: Mon Jun 13 03:05:51 CDT 2016
lvm2-libs-2.02.156-1.el7    BUILT: Mon Jun 13 03:05:51 CDT 2016
lvm2-cluster-2.02.156-1.el7    BUILT: Mon Jun 13 03:05:51 CDT 2016
device-mapper-1.02.126-1.el7    BUILT: Mon Jun 13 03:05:51 CDT 2016
device-mapper-libs-1.02.126-1.el7    BUILT: Mon Jun 13 03:05:51 CDT 2016
device-mapper-event-1.02.126-1.el7    BUILT: Mon Jun 13 03:05:51 CDT 2016
device-mapper-event-libs-1.02.126-1.el7    BUILT: Mon Jun 13 03:05:51 CDT 2016
device-mapper-persistent-data-0.6.2-0.1.rc8.el7    BUILT: Wed May  4 02:56:34 CDT 2016
cmirror-2.02.156-1.el7    BUILT: Mon Jun 13 03:05:51 CDT 2016
sanlock-3.3.0-1.el7    BUILT: Wed Feb 24 09:52:30 CST 2016
sanlock-lib-3.3.0-1.el7    BUILT: Wed Feb 24 09:52:30 CST 2016
lvm2-lockd-2.02.156-1.el7    BUILT: Mon Jun 13 03:05:51 CDT 2016

Comment 2 Peter Rajnoha 2016-06-21 08:50:52 UTC
(In reply to Corey Marthaler from comment #0)
> Description of problem:
> This is a reg check for bug 800012. It appears that everything but the attr
> was updated. Should be 'a-u' not 'a--'.
> 

No, we change this in the end (but released version in RHEL6 had that change included too). The 'u' was the 4th bit, not 3rd bit.

At first, we had 4 bits in pv_attr where the 4th one was the 'u' for 'used'. And it was pure binary - either used or not.

Then we optimized this and said it's not necessary to report 'a' in the 1st bit for "allocatable". If the PV is allocatable, it's clearly in some VG and hence used.

So we're reusing the 1st bit instead of adding a new 4th bit in pv_attr like it was at the beginning (see that the number of bits in pv_attr field is 3 now, not 4). The rule is:

  - if the 1st bit in pv_attr is 'a' allocatable, we surely have VG metadata because allocatability is property of VG metadata actually - we don't need to display the 'u' anywhere because if we have VG metadata, the PV is used (simply, 'a' implies 'u')

  - if the 1st bit in pv_attr is 'u' used, we're either missing VG metadata that would tell us about allocatability OR we have metadata, but the PV is not allocatable , but still in a VG (we can change allocatability by pvchange -x y/n).

So from your example:

[root@host-083 ~]# pvs -o pv_name,pv_attr,pv_ext_vsn,pv_in_use,pv_used /dev/sdg1
  PV         Attr PExtVsn PInUse Used
  /dev/sdg1  a--        2   used 1.01g

--> the PV sdg1 is 'a' allocatable, hence it's used.

The man pvs also has this mentioned (in a way):

The pv_attr bits are: (a)llocatable, e(x)ported, (m)issing, (u)sed (but not allocatable), (d)uplicate.

--> "used but not allocatable" (it's not allocatable if we changed that to not allocatable directly with pvchange -x n call or if we're missing VG metadata that would tell us anything about allocatability - hence we assume it's not allocatable).