<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:984435348;
        mso-list-type:hybrid;
        mso-list-template-ids:-1674166166 -1 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi Zdenek,</p><p class=MsoNormal>Thank you for your email.</p><p class=MsoNormal><o:p> </o:p></p><ul style='margin-top:0in' type=disc><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>If you know you are going to destroy whole VG - you can simply make sure,<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>there is no running  LV - and just recreate  PV/VG from scratch - certainly<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>faster them removing i.e.  thousand of LVs individually one-by-one which<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>is what will happen with lvremove/vgremove command ATM.<o:p></o:p></li></ul><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I tried to follow you for accelerated removal… did I interpret you correctly? I though hit the cache sync stuck issue. Please clarify what needs to change below. I see still cache flush happens while removing the vg.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>myhome$ sudo vgcreate pxtest /dev/sdc /dev/nvme0n1</p><p class=MsoNormal>  Volume group "pxtest" successfully created</p><p class=MsoNormal>myhome$</p><p class=MsoNormal>myhome$ sudo lvcreate -n cache --type cache-pool -l 100%pvs pxtest /dev/nvme0n1</p><p class=MsoNormal>  Logical volume "cache" created.</p><p class=MsoNormal>myhome$ sudo lvcreate -n pool --type cache --cachepool pxtest/cache -l 100%pvs pxtest /dev/sdc</p><p class=MsoNormal>  Logical volume "pool" created.</p><p class=MsoNormal>Myhome$</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>myhome$ sudo lvs pxtest</p><p class=MsoNormal>  LV   VG     Attr       LSize  Pool    Origin       Data%  Meta%  Move Log Cpy%Sync Convert</p><p class=MsoNormal>  pool pxtest Cwi---C--- 10.00g [cache] [pool_corig]</p><p class=MsoNormal>myhome$</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>myhome$ sudo vgchange -an pxtest</p><p class=MsoNormal>  0 logical volume(s) in volume group "pxtest" now active</p><p class=MsoNormal>myhome$ sudo vgremove -ff pxtest</p><p class=MsoNormal>  4096 blocks must still be flushed.</p><p class=MsoNormal>  4096 blocks must still be flushed.</p><p class=MsoNormal>  4096 blocks must still be flushed.</p><p class=MsoNormal>  4096 blocks must still be flushed.</p><p class=MsoNormal>^C</p><p class=MsoNormal>Myhome$</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>myhome$ sudo dmsetup status pxtest-pool</p><p class=MsoNormal>0 20963328 cache 8 40/2048 2048 4096/10220 28 58 0 0 0 0 4096 1 writethrough 2 migration_threshold 2048 cleaner 0 rw -</p><p class=MsoNormal>myhome$</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>myhome$ uname -r</p><p class=MsoNormal>4.4.0-131-generic</p><p class=MsoNormal>myhome$ sudo lvm version</p><p class=MsoNormal>  LVM version:     2.02.133(2) (2015-10-30)</p><p class=MsoNormal>  Library version: 1.02.110 (2015-10-30)</p><p class=MsoNormal>  Driver version:  4.34.0</p><p class=MsoNormal>myhome$</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Regards</p><p class=MsoNormal>LN</p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows 10</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='border:none;padding:0in'><b>From: </b><a href="mailto:zkabelac@redhat.com">Zdenek Kabelac</a><br><b>Sent: </b>Friday, August 2, 2019 6:14 PM<br><b>To: </b><a href="mailto:lvm-devel@redhat.com">LVM2 development</a>; <a href="mailto:lns@portworx.com">Lakshmi Narasimhan Sundararajan</a><br><b>Subject: </b>Re: [lvm-devel] lvmcache lv destroy with no flush</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Dne 01. 08. 19 v 6:50 Lakshmi Narasimhan Sundararajan napsal(a):</p><p class=MsoNormal>> Hi Team,</p><p class=MsoNormal>> </p><p class=MsoNormal>> A very good day to you all.</p><p class=MsoNormal>> </p><p class=MsoNormal>> Lets say, there exists a LVM cache LV in writeback mode with lots of dirty blocks.</p><p class=MsoNormal>> </p><p class=MsoNormal>> How can I destroy this LV without waiting for data sync to finish? This is a </p><p class=MsoNormal>> tear down operation and there is no necessity for data sync to complete.</p><p class=MsoNormal>> </p><p class=MsoNormal>> Any operation like lvremove, vgremove etc. all of it wait for the cache sync </p><p class=MsoNormal>> to complete before tearing down the lv/vg.</p><p class=MsoNormal>> </p><p class=MsoNormal>> Please let me know if there is a way to accomplish my requirement.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Currently this is not supported on lvm2 side - we usually want to flush cache </p><p class=MsoNormal>first - since we try to keep logic that lvm2 should be reversible for 1-step back.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So we tend to keep things flushed first.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On the other hand - we do have some 'long wanted' feature - like some smart </p><p class=MsoNormal>and fast 'accelerated' removal.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>i.e. when removing all thin + thin-pool -  skip removing individual thins,</p><p class=MsoNormal>and similar would apply to cache.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>These operation would be irreversible - but certainly much faster.....</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On the other hand there is usually way quicker workaround -</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>If you know you are going to destroy whole VG - you can simply make sure,</p><p class=MsoNormal>there is no running  LV - and just recreate  PV/VG from scratch - certainly</p><p class=MsoNormal>faster them removing i.e.  thousand of LVs individually one-by-one which</p><p class=MsoNormal>is what will happen with lvremove/vgremove command ATM.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>2nd. though - when the cache-pool is broken/missing - you can always remove </p><p class=MsoNormal>any LV with  'lvremove -ff'</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Regards</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Zdenek</p><p class=MsoNormal><o:p> </o:p></p></div></body></html>