Bug 644752

Summary: pvs command takes p_global lock and serializes other (even unrelated) pvs commands
Product: Red Hat Enterprise Linux 6 Reporter: Ayal Baron <abaron>
Component: lvm2Assignee: Petr Rockai <prockai>
Status: CLOSED ERRATA QA Contact: Corey Marthaler <cmarthal>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: agk, coughlan, cpelland, ddumas, dwysocha, heinzm, iheim, jbrassow, nperic, perfbz, prajnoha, prockai
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: storage
Fixed In Version: lvm2-2.02.98-5.el6 Doc Type: Bug Fix
Doc Text:
Allow more than one process to iterate through Physical Volumes concurrently only when using lvmetad. lvmetad makes the existing lock unnecessary.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 08:02:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 756082, 773650, 773651, 773665, 773677, 773696, 888457    

Description Ayal Baron 2010-10-20 08:07:15 UTC
Description of problem:
Running "pvs" takes an exclusive lock which prevents running multiple pvs commands concurrently.
Even if different filters are used (which contain entirely different devices) the commands are still serialized.

Comment 1 Alasdair Kergon 2010-10-28 11:44:19 UTC
What is the full 'pvs' command line you are using?  (Perhaps an alternative command would suffice, or perhaps that specific form of the command doesn't need the lock even though it takes it by default.)

Comment 2 Ayal Baron 2010-10-28 12:07:48 UTC
pvs --config (filter with one device) PV_NAME
with or without additional fields, but I don't think that should matter.

Comment 3 Alasdair Kergon 2010-10-28 12:34:00 UTC
which fields?  pv fields?  vg fields?  lv fields?  It makes a difference.

Comment 4 Alasdair Kergon 2010-10-28 12:35:23 UTC
And do you know anything about the PV in advance?

For example, do you know that it always belongs to a VG - or might it be orphaned?  If it belongs to a VG do you know the name of that VG already or not?

Comment 5 Ayal Baron 2010-10-28 12:57:04 UTC
pv fields.
and many times we know the name of the vg, yes, but if this pv does not contain an mda...

Comment 6 Alasdair Kergon 2010-10-28 13:01:27 UTC
If you're only accessing PV fields, it's irrelevant whether there's an mda or not.

Comment 7 Alasdair Kergon 2010-10-28 13:02:55 UTC
well - please just provide the lists of fields so we can see if there's anything we can do.   The global lock is certainly required by pvs in the general case, but perhaps your specific case doesn't need it - I don't know.

Comment 8 Ayal Baron 2010-11-24 10:58:00 UTC
what we run today is:

lvm pvs --noheadings --units b --nosuffix --separator | -o uuid,name,size,vg_name,vg_uuid,pe_count,pe_alloc_count,mda_count

Comment 10 Milan Broz 2011-03-23 11:53:27 UTC
So it prints fields which need to be parsed from metadata (not only field in PV header).

This is basically either request for some unlocked way how to read metadata and/or for performance improvement when reading it.

Comment 17 Alasdair Kergon 2012-12-05 15:02:32 UTC
So *if* lvmetad is in use, can we skip setting lock_global in process_each_pv() and rely on individual locks instead?

Comment 18 Petr Rockai 2012-12-06 11:03:17 UTC
Hmm. I think it should be OK to not take the lock if we are talking to lvmetad, but we should double-check that no other code (besides just reading metadata) relying on the lock crept in.

Comment 20 Petr Rockai 2012-12-12 13:45:11 UTC
Pushed upstream as e5709a3..b19f840.

Comment 22 Nenad Peric 2012-12-12 14:14:30 UTC
Marking as SanityOnly, 
QA will mark it as verified upon completion of the last REG test run.

Comment 24 errata-xmlrpc 2013-02-21 08:02:54 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