Bug 209370 - node shouldn't be able to remove an LV if another node has it activated exclusively
node shouldn't be able to remove an LV if another node has it activated exclu...
Product: Red Hat Cluster Suite
Classification: Red Hat
Component: lvm2-cluster (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Christine Caulfield
Cluster QE
Depends On:
  Show dependency treegraph
Reported: 2006-10-04 17:27 EDT by Corey Marthaler
Modified: 2010-01-11 23:05 EST (History)
4 users (show)

See Also:
Fixed In Version: RHBA-2007-0046
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-05-10 17:07:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Corey Marthaler 2006-10-04 17:27:37 EDT
Description of problem:

# LV inactive in the cluster
[root@link-02 tmp]# lvscan
  inactive          '/dev/vg1/lv1' [10.00 GB] inherit
[root@link-08 lvm]# lvscan
  inactive          '/dev/vg1/lv1' [10.00 GB] inherit

# LV gets activated on link-08 only
[root@link-08 lvm]# vgchange -aye
  0 logical volume(s) in volume group "vg2" now active
  1 logical volume(s) in volume group "vg1" now active

[root@link-02 tmp]# lvscan
  inactive          '/dev/vg1/lv1' [10.00 GB] inherit
[root@link-08 lvm]# lvscan
  ACTIVE            '/dev/vg1/lv1' [10.00 GB] inherit

# But link-02 is able to remove it from link-08
[root@link-02 tmp]# lvremove /dev/vg1/lv1
  Logical volume "lv1" successfully removed

Version-Release number of selected component (if applicable):
[root@link-02 tmp]# rpm -qa lvm2-cluster

How reproducible:
Comment 1 Alasdair Kergon 2006-10-04 17:44:41 EDT
This one's been there for a long time - it has only ever checked for activity on
the local node.

Two options:

  1) Pass the 'active' status around the cluster, so the existing "is active?"
query will give a cluster-wide answer;

  2) Do locking tricks so the local node has exclusive control before it can be

I reckon it's time we attempted (1) now.  In other words remove the direct calls
into lib/activate for lv_info-related information and always get it indirectly
via the locking layer.
Comment 2 Christine Caulfield 2006-10-05 09:23:49 EDT
I suspect that as far as clvmd is concerned 1) and 2) are very similar.

Testing for a lock in the cluster is easiest done by attempting to get an EX
lock on the resource (especially so since the new DLM doesn't yet have the query
interface that RHEL4 has).

Provided the VG lock is held throughout this operation there will be no races.
Comment 3 Corey Marthaler 2006-10-05 12:36:31 EDT
How do the other alteration lvm commands works currently?

# Wont let me rename it if the lock is elsewhere
[root@link-02 ~]# lvrename /dev/linear_4_3390/lv /dev/linear_4_3390/rename
  cluster request failed: Resource temporarily unavailable

# Wont let me reduce it either
[root@link-02 ~]# lvreduce -L 1G /dev/linear_4_3390/lv
  Reducing logical volume lv to 1.00 GB
  cluster request failed: Resource temporarily unavailable
  Failed to suspend lv
Comment 4 Christine Caulfield 2006-10-10 04:35:09 EDT
Effectively because they do 2) above.

LVM attempts to suspend the LV on all the nodes before doing the operation. In
this case it can't because it's locked exclusively on another node.

I suspect Alasdair would regard it as a gross hack to suspend the LV before
removing it ;-)
Comment 5 Christine Caulfield 2006-10-23 07:47:22 EDT
lvremove now attempts to get an exclusisive lock on the resource before removing
the LV

Checking in WHATS_NEW;
/cvs/lvm2/LVM2/WHATS_NEW,v  <--  WHATS_NEW
new revision: 1.477; previous revision: 1.476
Checking in tools/lvremove.c;
/cvs/lvm2/LVM2/tools/lvremove.c,v  <--  lvremove.c
new revision: 1.49; previous revision: 1.48
Comment 6 Corey Marthaler 2006-11-01 15:22:56 EST
fix verified in lvm2-2.02.13-1.
Comment 8 Red Hat Bugzilla 2007-05-10 17:07:23 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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