Bug 812965

Summary: lvresize does not release the deleted blocks after reducing the thin disk size
Product: [Fedora] Fedora Reporter: Xiaowei Li <xiaoli>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 17CC: agk, bmarzins, bmr, dwysocha, heinzm, jonathan, lvm-team, msnitzer, prajnoha, prockai, qcai, zkabelac
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-01 18:14:16 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:

Description Xiaowei Li 2012-04-16 16:45:08 UTC
Description of problem:
lvresize does not release the deleted blocks after reducing the thin disk size

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:                 
[root@laker ~]# dd if=/dev/zero of=/dev/vg/tp bs=1M count=100

[root@laker ~]# lvs vg
  LV   VG   Attr     LSize   Pool Origin Data%  Move Log Copy%  Convert
  pool vg   twi-a-tz 200.00m              50.00                        
  tp   vg   Vwi-a-tz 100.00m pool        100.00   

[root@laker ~]# lvresize -L -50M vg/tp

[root@laker ~]# lvs vg
  LV   VG   Attr     LSize   Pool Origin Data%  Move Log Copy%  Convert
  pool vg   twi-a-tz 200.00m              50.00                        
  tp   vg   Vwi-a-tz  52.00m pool        192.31            

  
Actual results:
The allocated blocks are still 100(50%) after reducing the thin disk size to 50M. 

Expected results:
The allocated blocks should be 50(25%)

Additional info:

Comment 1 Zdenek Kabelac 2012-04-17 08:51:54 UTC
Yes - known issue - we will need to provide some policy how to handle downsize of thin LV in this case - the problem here is - for normal volume you'd always chance to step back if you make a mistake -  but if the pool would immediately release block from unused part a resized device - we could never get them back. Also the much better use will be when there will be supported real discard over pool device - which is going to be part of 3.4 kernel.

There might be few way how to handle this - we may have policy to release block with resize - and there would be no way back. Or we may keep history of max size of device and try to drop blocks when we the pool is getting overfilled. Another way might be to provide some  'pool flush' command which would drop discard unused block in pool making it a point of no return.  It's also releated to vgcfgrestore issue we currently do not have resolved.

Comment 2 Xiaowei Li 2012-05-07 07:23:23 UTC
(In reply to comment #1)
> Yes - known issue - we will need to provide some policy how to handle downsize
> of thin LV in this case - the problem here is - for normal volume you'd always
> chance to step back if you make a mistake -  but if the pool would immediately
> release block from unused part a resized device - we could never get them back.
> Also the much better use will be when there will be supported real discard over
> pool device - which is going to be part of 3.4 kernel.
> 
> There might be few way how to handle this - we may have policy to release block
> with resize - and there would be no way back. Or we may keep history of max
> size of device and try to drop blocks when we the pool is getting overfilled.
> Another way might be to provide some  'pool flush' command which would drop
> discard unused block in pool making it a point of no return.  It's also
> releated to vgcfgrestore issue we currently do not have resolved.

We cannot discard the used blocks and the thin-lv's size is virtual size. 
So we should make sure that the min size of thin LV is not less than the already allocated size while doing lvreduce.

Also i don't think lvm knows which allocated block is used or not by the application. So another suggestion, we should integrate fstrim with lvm thin-reclaim since the file system should know if the block is used.(currently the fstrim cannot discard unused block on the file system on the thin LV)

Comment 3 Fedora End Of Life 2013-07-04 06:37:54 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. 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 WONTFIX if it remains open with a Fedora 
'version' of '17'.

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 prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 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 to Fedora 17's end of life.

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 4 Fedora End Of Life 2013-08-01 18:14:22 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 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.

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