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 862253 - [lvmetad] deadlock
Summary: [lvmetad] deadlock
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Petr Rockai
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-02 13:04 UTC by Marian Csontos
Modified: 2013-02-21 08:14 UTC (History)
11 users (show)

Fixed In Version: lvm2-2.02.98-1.el6
Doc Type: Bug Fix
Doc Text:
Under relatively heavy load (many parallel LVM commands running) lvmetad could deadlock and cause other LVM commands to stop responding. The problem has been tracked down to a race condition in lvmetad's multi-threaded code and has been fixed.
Clone Of:
Environment:
Last Closed: 2013-02-21 08:14:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0501 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2013-02-20 21:30:45 UTC

Description Marian Csontos 2012-10-02 13:04:50 UTC
Description of problem:
running pvs in parallel may result in deadlock

Version-Release number of selected component (if applicable):
- upstream git commit 886656e4 (nightly build 2.02.98-0.183.el6.x86_64)

How reproducible:
- low

Steps to Reproduce:
1. run few pvs in parallel
  
Actual results:
deadlock

Expected results:
both command should succeed

Additional info:
## Thread_16 waiting for lock_vg, hold by Thread_20 acquired on Line_130 in lock_vg

    Thread 16 (Thread 0x7f7b73eef700 (LWP 4086)):
    #0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
    #1  0x00007f7b746e73a3 in _L_lock_892 () from /lib64/libpthread.so.0
    #2  0x00007f7b746e7287 in __pthread_mutex_lock (mutex=0x7f7b6c001d00)
        at pthread_mutex_lock.c:82
    #3  0x0000000000402ee9 in lock_vg (s=0x7fffb5b85ef0, 
        id=0x12692a0 "yxBztw-XtbD-vYva-nnNA-mdpf-vxvK-4wWLLe") at lvmetad-core.c:130
    #4  0x0000000000404777 in vg_lookup (s=..., h=..., r=...) at lvmetad-core.c:431
    #5  handler (s=..., h=..., r=...) at lvmetad-core.c:955
    #6  0x00000000004052e4 in client_thread (baton=0x1144150) at daemon-server.c:391
    #7  0x00007f7b746e5851 in start_thread (arg=0x7f7b73eef700) at pthread_create.c:301
    #8  0x00007f7b7443367d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

### lock_vg - owned by Thread_20

    #2  0x00007f7b746e7287 in __pthread_mutex_lock (mutex=0x7f7b6c001d00)
    (gdb) print mutex->__data.__owner
    $6 = 4066 # Thread_20

## Thread_20 waiting for lock_vgid_to_metadata, hold by Thread_16 acquired on Line_115 in lock_vg

    Thread 20 (Thread 0x7f7b716eb700 (LWP 4066)):
    #0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
    #1  0x00007f7b746e73a3 in _L_lock_892 () from /lib64/libpthread.so.0
    #2  0x00007f7b746e7287 in __pthread_mutex_lock (mutex=0x7fffb5b85f60)
        at pthread_mutex_lock.c:82
    #3  0x0000000000402dce in lock_vgid_to_metadata (s=0x7fffb5b85ef0, 
        id=0x128f720 "yxBztw-XtbD-vYva-nnNA-mdpf-vxvK-4wWLLe") at lvmetad-core.c:87
    #4  unlock_vg (s=0x7fffb5b85ef0, id=0x128f720 "yxBztw-XtbD-vYva-nnNA-mdpf-vxvK-4wWLLe")
        at lvmetad-core.c:140
    #5  0x000000000040488b in vg_lookup (s=..., h=..., r=...) at lvmetad-core.c:467
    #6  handler (s=..., h=..., r=...) at lvmetad-core.c:955
    #7  0x00000000004052e4 in client_thread (baton=0x1167060) at daemon-server.c:391
    #8  0x00007f7b746e5851 in start_thread (arg=0x7f7b716eb700) at pthread_create.c:301
    #9  0x00007f7b7443367d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

### lock_vgid_to_metadata - owned by Thread_16:

    #2  0x00007f7b746e7287 in __pthread_mutex_lock (mutex=0x7fffb5b85f60)
    (gdb) print mutex->__data.__owner
    $8 = 4086 # Thread_16

Comment 2 Petr Rockai 2012-10-08 14:33:50 UTC
Should be fixed upstream now.

Comment 3 Alasdair Kergon 2012-10-08 16:07:18 UTC
What was wrong?  How was it fixed?

Comment 5 Petr Rockai 2012-10-09 09:12:33 UTC
commit 6e312c56adb04e709819868c6fa89f5984013a65
    lvmetad: Avoid overlapping locks that could cause a deadlock (BZ 862253).

The bug was present in 6.3 as well, but apparently never tripped. The fix was relatively easy (see patch: git log 6e312c56adb04e709819868c6fa89f5984013a65 -p -n 1).

Comment 6 Petr Rockai 2012-10-12 09:10:23 UTC
To QA: The reproducer should be the original bug description, i.e. run "pvs" in parallel while lvmetad is running. When lvmetad stops responding, you have hit the bug. (I didn't manage to reproduce the problem myself, but I could see the problem in the source code. Marian should be able to reproduce this. I'd say if you stress-test lvmetad with parallel access from multiple LVM commands for a while and don't hit a deadlock, it's as verified as it gets).

Comment 9 Corey Marthaler 2013-01-24 21:48:55 UTC
I was unable to hit a deadlock, but I was able to hit what appears to be bug 889361 fairly easily.

# run 20 pvs in parallel:

  [...]
  Skipping volume group raid_sanity
  Volume group "raid_sanity" not found
  Request to list PVs in lvmetad gave response Connection reset by peer.

Jan 24 15:30:10 hayes-03 kernel: lvmetad[25889] general protection ip:3a97a76205 sp:7f1b1cdf9b90 error:0 in libc-2.12.so[3a97a00000+18a000]


[root@hayes-03 ~]# pvscan
  WARNING: Failed to connect to lvmetad: Connection refused. Falling back to internal scanning.
  PV /dev/etherd/e1.1p1    VG raid_sanity   lvm2 [908.23 GiB / 907.93 GiB free]
  PV /dev/etherd/e1.1p10   VG raid_sanity   lvm2 [908.23 GiB / 908.23 GiB free]
  PV /dev/etherd/e1.1p2    VG raid_sanity   lvm2 [908.23 GiB / 908.23 GiB free]

Comment 11 errata-xmlrpc 2013-02-21 08:14:12 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


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