Bug 1314292 - [RFE] add discard support for lvremove of thin volumes
Summary: [RFE] add discard support for lvremove of thin volumes
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: lvm2
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: LVM and device-mapper development team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 817768
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-03 10:51 UTC by Till Maas
Modified: 2016-12-20 19:12 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-12-20 19:12:42 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Till Maas 2016-03-03 10:51:36 UTC
Description of problem:
When lvremove is used to remove a lv from a thinpool, lvremove asks whether to DISCARD it, but  it does not discard the blocks.

Version-Release number of selected component (if applicable):
lvm2-2.02.132-2.fc23

How reproducible:
always

Steps to Reproduce:
1.  lvcreate --name test -V 1G --thinpool ssd/thinp
2.  lvremove /dev/ssd/test
3. Answer y to "Do you really want to remove and DISCARD active logical volume test? [y/n]:"

Actual results:
lv is removed without discarding blocks

Expected results:
blocks used by the LV should be discarded

Additional info:
Discards can be monitored with strace or 
blktrace -a issue -d /dev/sda -o - | blkparse -i - | grep 'D.*D'

Comment 1 Zdenek Kabelac 2016-03-03 11:38:45 UTC
(In reply to Till Maas from comment #0)
> Description of problem:
> When lvremove is used to remove a lv from a thinpool, lvremove asks whether
> to DISCARD it, but  it does not discard the blocks.
> 

This is misunderstanding of 'issue_discard'  lvm.conf option.

This option specifies what is going to happen with just released 'extents' in your VG - while  when you remove any 'thin' LV there are no released extents.
They all still belong to running thin-pool - which is the 'exclusive' owner of
extents.

Note - there was a bug in some fc23 kernel where discard support has got broken, so make sure you have the right kernel.

But when you release thin in thin-pool - you should see instant drop
of used space (if your LV was holding exclusively provisioned blocks).

Comment 2 Till Maas 2016-03-03 13:28:17 UTC
(In reply to Zdenek Kabelac from comment #1)

> This option specifies what is going to happen with just released 'extents'
> in your VG - while  when you remove any 'thin' LV there are no released
> extents.
> They all still belong to running thin-pool - which is the 'exclusive' owner
> of
> extents.

lvremove says it will discard the blocks:

"Do you really want to remove and DISCARD active logical volume test? [y/n]:"

So if lvremove is expected to not discard the blocks, then the prompt needs to be changed, therefore this is still a bug IMHO.

Nevertheless, it also makes sense to discard the blocks, even if they still belong to a thinpool, therefore I hope you will implement this, even if this is a feature request and the bad prompt is the bug at the moment.

> Note - there was a bug in some fc23 kernel where discard support has got
> broken, so make sure you have the right kernel.
> 
> But when you release thin in thin-pool - you should see instant drop
> of used space (if your LV was holding exclusively provisioned blocks).

discard works with the kernel, but lvm2 uses bad code to figure out whether discard is supported as reported in bug 1313377

Comment 3 Till Maas 2016-03-04 08:14:13 UTC
Comment https://bugzilla.redhat.com/show_bug.cgi?id=1313377#c6 from Alasdair Kergon:
| Yes, lvremove ought to be able to discard thin volumes before removing them.  | We need to fix that.

Comment 4 Zdenek Kabelac 2016-03-04 09:23:23 UTC
So switching to 'RFE'  as that's nontrivial amount of work.

Kernel target on its own is not discarding released chunks and such discard is supposed to happen within user-space context.

Discard itself on large volume might take quite while so it's not viable to be made while holding VG lock.

As a 'workaround' user may ATM run 'blkdiscard' prior calling lvremove.

For now LV support only discards an 'empty' PV space - but in this case where thin-pool is still holder of released space, we cannot follow the meaning of issue_discard - and will need to extend it to allow  running discard while
LV is still active (so there are going to be races to think about).

The work on such discard support is likely related to fixing prompt for lvremove
and also removal of mutliple LVs efficiently (i.e. when whole pool is removed
we should not slowly discard individual thin LVs)

Comment 5 Fedora End Of Life 2016-11-24 15:54:06 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2016-12-20 19:12:42 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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