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 903411 - lvchange activation issues when dealing w/ thin pool volumes and discard options
Summary: lvchange activation issues when dealing w/ thin pool volumes and discard options
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.4
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Zdenek Kabelac
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks: 960054 969168
TreeView+ depends on / blocked
 
Reported: 2013-01-23 23:03 UTC by Corey Marthaler
Modified: 2013-11-21 23:19 UTC (History)
12 users (show)

Fixed In Version: lvm2-2.02.100-1.el6
Doc Type: Known Issue
Doc Text:
Activating a logical volume can fail if the --thinpool and --discards options are specified on logical-volume creation. To work around this problem, manually deactive all thin volumes related to the changed thin pool prior to running the lvchange command.
Clone Of:
: 969168 (view as bug list)
Environment:
Last Closed: 2013-11-21 23:19:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1704 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2013-11-20 21:52:01 UTC

Description Corey Marthaler 2013-01-23 23:03:42 UTC
Description of problem:
SCENARIO - [convert_pool_discard_opts]
Creating [ignore] discards thinpool volume and converting it to [nopassdown] discards
lvcreate --thinpool POOL --discards ignore -L 2G snapper_thinp
lvcreate --virtualsize 500M --thinpool snapper_thinp/POOL -n origin
lvcreate -s /dev/snapper_thinp/origin -n snap
Deactivating LV before conversion
lvchange --discards nopassdown snapper_thinp/POOL
  device-mapper: reload ioctl on  failed: Invalid argument
LV activation failed

Jan 23 17:00:15 qalvm-01 kernel: device-mapper: table: 253:4: thin-pool: Discard support cannot be disabled once enabled
Jan 23 17:00:15 qalvm-01 kernel: device-mapper: ioctl: error adding target to table


vgchange however works:
[root@qalvm-01 ~]# vgchange -an snapper_thinp
  0 logical volume(s) in volume group "snapper_thinp" now active

Version-Release number of selected component (if applicable):
2.6.32-354.el6.x86_64
lvm2-2.02.98-9.el6    BUILT: Wed Jan 23 10:06:55 CST 2013
lvm2-libs-2.02.98-9.el6    BUILT: Wed Jan 23 10:06:55 CST 2013
lvm2-cluster-2.02.98-9.el6    BUILT: Wed Jan 23 10:06:55 CST 2013
udev-147-2.43.el6    BUILT: Thu Oct 11 05:59:38 CDT 2012
device-mapper-1.02.77-9.el6    BUILT: Wed Jan 23 10:06:55 CST 2013
device-mapper-libs-1.02.77-9.el6    BUILT: Wed Jan 23 10:06:55 CST 2013
device-mapper-event-1.02.77-9.el6    BUILT: Wed Jan 23 10:06:55 CST 2013
device-mapper-event-libs-1.02.77-9.el6    BUILT: Wed Jan 23 10:06:55 CST 2013
cmirror-2.02.98-9.el6    BUILT: Wed Jan 23 10:06:55 CST 2013


How reproducible:
Everytime

Comment 1 Mike Snitzer 2013-01-24 00:06:15 UTC
(In reply to comment #0)
> Description of problem:
> SCENARIO - [convert_pool_discard_opts]
> Creating [ignore] discards thinpool volume and converting it to [nopassdown]
> discards
> lvcreate --thinpool POOL --discards ignore -L 2G snapper_thinp
> lvcreate --virtualsize 500M --thinpool snapper_thinp/POOL -n origin
> lvcreate -s /dev/snapper_thinp/origin -n snap
> Deactivating LV before conversion
> lvchange --discards nopassdown snapper_thinp/POOL
>   device-mapper: reload ioctl on  failed: Invalid argument
> LV activation failed
> 
> Jan 23 17:00:15 qalvm-01 kernel: device-mapper: table: 253:4: thin-pool:
> Discard support cannot be disabled once enabled
> Jan 23 17:00:15 qalvm-01 kernel: device-mapper: ioctl: error adding target
> to table

The kernel error speaks to the pool having been activated with discards enabled and, without first being deactivated, the discard mode change was attempted via reload.

Such a transition is not allowed by the kernel.

So if you're attempting to first deactivate the pool, then change the discard mode, then reactivate the pool I'd start with verifying the pool is no longer active in the kernel (via dmsetup table) when you expect it to not be active.

I cannot be more precise with my guidance because I don't understand the implicit deactivations that are associated with the lvm commands you've listed (Zdenek should be able to).  But none of the commands clearly and explicitly deactivate the pool before you attempt to change the discard mode.

Comment 2 Zdenek Kabelac 2013-01-24 10:04:57 UTC
Yep - bug which needs some thinking - cluster supports makes it harder.

For now there is an 'incorrect' check for having  vg/pool active - but the 'real' pool is in the table with -tpool.  So if there is just deactivated pool - the LV/lock representing pool is deactivated - however other thin volumes using pool keeps the 'real' -tpool active.  So the lvchange allows the 'change' of discard, since it thinks pool is inactive - but an next activation of committed metadata will face the troubles with unacceptable ioctl whatever command it will be.

Current workaround is to manually deactivate all thin volumes related to the changed thin pool in front of lvchange command.

Comment 3 Zdenek Kabelac 2013-02-05 20:21:21 UTC
Fixed upstream with these patches:

https://www.redhat.com/archives/lvm-devel/2013-February/msg00037.html
https://www.redhat.com/archives/lvm-devel/2013-February/msg00038.html
https://www.redhat.com/archives/lvm-devel/2013-February/msg00048.html

All thin pool thin volumes are checked prior some variant of discards are allowed.

Comment 10 Nenad Peric 2013-10-09 15:00:44 UTC
Ran the test multiple times, with different configuration without a hitch (raid1/raid10 as origins as well)
Tested with:

snapper_thinp -o virt-011 -e convert_pool_discard_opts -i 3 
(and -t raid1 and raid10)

Marking this VERIFIED with:

lvm2-2.02.100-4.el6.x86_64

Comment 11 errata-xmlrpc 2013-11-21 23:19:49 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-1704.html


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