Bug 1348343 - used nomda PV is missing the 'u' attribute in the pv_attr
Summary: used nomda PV is missing the 'u' attribute in the pv_attr
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.3
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: LVM and device-mapper development team
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-20 22:08 UTC by Corey Marthaler
Modified: 2021-09-03 12:40 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-21 08:50:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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).


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