Bug 994315

Summary: Improve error message when failing to change the discard mode on active volume
Product: Red Hat Enterprise Linux 7 Reporter: Xiaowei Li <xiaoli>
Component: lvm2Assignee: Alasdair Kergon <agk>
lvm2 sub component: Default / Unclassified QA Contact: Cluster QE <mspqa-list>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: high    
Priority: high CC: agk, cmarthal, heinzm, jbrassow, msnitzer, nperic, prajnoha, prockai, qcai, thornber, zkabelac
Version: 7.0Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.103-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1003470 (view as bug list) Environment:
Last Closed: 2014-06-13 12:10:03 UTC Type: Bug
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: 1003470    

Description Xiaowei Li 2013-08-07 03:24:00 UTC
Description of problem:


Version-Release number of selected component (if applicable):
lvm2-2.02.99-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. tsvg/pool2 is nopassdown discard mode
2. lvchange -an tsvg/pool2
2. lvchange --discards ignore tsvg/pool2
    
[root@dhcp12-156 tc]# lvs -o+discards tsvg
  LV    VG   Attr       LSize   Pool  Origin Data%  Move Log Cpy%Sync Convert Discards  
  lv1   tsvg Vwi-a-tz-- 100.00m pool1          0.00                           passdown  
  lv2   tsvg Vwi-a-tz-- 100.00m pool2          0.00                           nopassdown
  lv3   tsvg Vwi---tz-k 100.00m pool1 lv1                                     passdown  
  lv4   tsvg Vwi---tz-k 100.00m pool1 lv3                                     passdown  
  pool1 tsvg twi-a-tz-- 100.00m                0.00                           passdown  
  pool2 tsvg twi---tz-- 104.00m                0.00                           nopassdown

[root@dhcp12-156 tc]# lvchange --discards ignore tsvg/pool2
  Cannot change discards state for active pool volume "pool2".

[root@dhcp12-156 tc]# lvchange --discards passdown tsvg/pool2
  Logical volume "pool2" changed.

[root@dhcp12-156 tc]# lvs -o+discards tsvg
  LV    VG   Attr       LSize   Pool  Origin Data%  Move Log Cpy%Sync Convert Discards
  lv1   tsvg Vwi-a-tz-- 100.00m pool1          0.00                           passdown
  lv2   tsvg Vwi-a-tz-- 100.00m pool2          0.00                           passdown
  lv3   tsvg Vwi---tz-k 100.00m pool1 lv1                                     passdown
  lv4   tsvg Vwi---tz-k 100.00m pool1 lv3                                     passdown
  pool1 tsvg twi-a-tz-- 100.00m                0.00                           passdown
  pool2 tsvg twi---tz-- 104.00m                0.00                           passdown


Actual results:


Expected results:


Additional info:

Comment 1 Xiaowei Li 2013-08-07 03:32:39 UTC
#format_text/archiver.c:136     Archiving volume group "tsvg" metadata (seqno 61).
#activate/dev_manager.c:478         Getting device info for tsvg-pool2-tpool [LVM-p9ndbUuxK6EZrInYsf912i7fyMDKxYbOdZ5wTa7JpkYudaYv5NvYrPjVVMeWaXgn-tpool]
#ioctl/libdm-iface.c:1724         dm version   OF   [16384] (*1)
#ioctl/libdm-iface.c:1724         dm info  LVM-p9ndbUuxK6EZrInYsf912i7fyMDKxYbOdZ5wTa7JpkYudaYv5NvYrPjVVMeWaXgn-tpool NF   [16384] (*1)
#lvchange.c:124   Cannot change discards state for active pool volume "pool2".
#lvchange.c:1123         <backtrace>

Comment 3 Zdenek Kabelac 2013-08-08 23:16:38 UTC
As long as the pool is active  - user can't change discards flag.

However   lvchange -an vgname/poolname  only deactivates 'fake' pool target - which is used to manipulate with pool when no other thin volume is active.
But as long as any  thin volume is using given thin pool internal pool can't be deactivated.

Admittedly the interface here is not very clean and rather confusing - but it's been side-step for clustered activation.

So for now - there is technically no bug  - but the information message is not the best and could provide more information - i.e.  giving info about the number of active thin volumes using this pool - I'll think about that.

So as a quick fix

lvchange -an tsvg/lv2

will make the change of --discards possible.

Comment 7 Mike Snitzer 2013-09-06 18:27:11 UTC
(In reply to Xiaowei Li from comment #0)

[snip... pool2 was using discard mode of "nopassdown", pool2 is still active]

> [root@dhcp12-156 tc]# lvchange --discards ignore tsvg/pool2
>   Cannot change discards state for active pool volume "pool2".
> 
> [root@dhcp12-156 tc]# lvchange --discards passdown tsvg/pool2
>   Logical volume "pool2" changed.
> 
> [root@dhcp12-156 tc]# lvs -o+discards tsvg
>   LV    VG   Attr       LSize   Pool  Origin Data%  Move Log Cpy%Sync
> Convert Discards
>   lv1   tsvg Vwi-a-tz-- 100.00m pool1          0.00                         
> passdown
>   lv2   tsvg Vwi-a-tz-- 100.00m pool2          0.00                         
> passdown
>   lv3   tsvg Vwi---tz-k 100.00m pool1 lv1                                   
> passdown
>   lv4   tsvg Vwi---tz-k 100.00m pool1 lv3                                   
> passdown
>   pool1 tsvg twi-a-tz-- 100.00m                0.00                         
> passdown
>   pool2 tsvg twi---tz-- 104.00m                0.00                         
> passdown

Both pool2 and lv2 are now using "passdown"; even though pool2 wasn't deactivated (so the kernel would not allow such a discard mode transition)

(In reply to Zdenek Kabelac from comment #3)
> As long as the pool is active  - user can't change discards flag.
> 
> However   lvchange -an vgname/poolname  only deactivates 'fake' pool target
> - which is used to manipulate with pool when no other thin volume is active.
> But as long as any  thin volume is using given thin pool internal pool can't
> be deactivated.
> 
> Admittedly the interface here is not very clean and rather confusing - but
> it's been side-step for clustered activation.
> 
> So for now - there is technically no bug  - but the information message is
> not the best and could provide more information - i.e.  giving info about
> the number of active thin volumes using this pool - I'll think about that.
> 
> So as a quick fix
> 
> lvchange -an tsvg/lv2
> 
> will make the change of --discards possible.

There is still a bug.  lvm2 shouldn't allow a transition from "nopassdown" to "passdown" while the pool2 is active (and in-use by lv2).

Comment 8 Mike Snitzer 2013-09-06 19:09:26 UTC
(In reply to Mike Snitzer from comment #7)

> There is still a bug.  lvm2 shouldn't allow a transition from "nopassdown"
> to "passdown" while the pool2 is active (and in-use by lv2).

Ngh, this isn't true.  Discards are still enabled in that case.  Just whether or not they are passed down to the underlying data device is what is being toggled.

So lvm2 is doing the right thing here.  Sorry for the noise.

Comment 9 Mike Snitzer 2013-09-06 19:21:44 UTC
(In reply to Zdenek Kabelac from comment #3)
> As long as the pool is active  - user can't change discards flag.
> 
> However   lvchange -an vgname/poolname  only deactivates 'fake' pool target
> - which is used to manipulate with pool when no other thin volume is active.
> But as long as any  thin volume is using given thin pool internal pool can't
> be deactivated.
> 
> Admittedly the interface here is not very clean and rather confusing - but
> it's been side-step for clustered activation.
> 
> So for now - there is technically no bug  - but the information message is
> not the best and could provide more information - i.e.  giving info about
> the number of active thin volumes using this pool - I'll think about that.

Probably only need to change the error message from:
'Cannot change discards state for active pool volume "pool2".'

to:
'Cannot change discards support for active pool volume "pool2".'

Subtle change, but "support" implies the overall discard capability (at least to me anyway).

Comment 13 Nenad Peric 2014-01-30 08:21:30 UTC
[root@virt-123 ~]# lvs -o+discards
  LV    VG            Attr       LSize   Pool  Origin Data%  Move Log Cpy%Sync Convert Discards
  lv1   my_vg         Vwi---tz--   1.00g pool1                                         passdown
  pool1 my_vg         twi-a-tz--   1.00g                0.00                           passdown
  root  rhel_virt-123 -wi-ao----   6.71g                                                       
  swap  rhel_virt-123 -wi-ao---- 820.00m                                                       
[root@virt-123 ~]# lvchange --discards ignore my_vg/pool1
  Cannot change support for discards while pool volume "pool1" is active.
[root@virt-123 ~]# lvchange -an my_vg/pool1
[root@virt-123 ~]# lvchange --discards ignore my_vg/pool1
  Logical volume "pool1" changed.

Disabling passdown while some part of the pool is active is not possible. 
The message should point in the right direction now. 

Marking VERIFIED with lvm2-2.02.105-2.el7.x86_64

Comment 14 Ludek Smid 2014-06-13 12:10:03 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.