[Kernel-packages] [Bug 1920821] Re: BLKDISCARD fails on LUKS volume hosting LVM PV
5.11.6 bad, 5.11.7 good @juerg I think you are getting your kernels confused; 5.11.0-11 seems to be based on 5.11 + some cherry-picks, not 5.11.7; 5.11.7 tracking bug is bug 1919492, which is not yet fixed. -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920821 Title: BLKDISCARD fails on LUKS volume hosting LVM PV Status in Linux: Fix Released Status in linux package in Ubuntu: New Status in linux source package in Hirsute: New Bug description: Creating a logical volume and destroying it fails to discard the volume, on an encrypted installation. This can significantly increase wear on SSDs when a lot of LVs are created and destroyed. jak@jak-t480s:~:master$ sudo lvcreate -L 10G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo strace -e ioctl blkdiscard /dev/ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKDISCARD, [0, 10737418240]) = 0 +++ exited with 0 +++ jak@jak-t480s:~:master$ sudo strace -e ioctl lvremove ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [512110190592]) = 0 ioctl(3, BLKGETSIZE64, [119226368]) = 0 ioctl(3, DM_VERSION, {version=4.0.0, data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.43.0, data_size=16384, flags=DM_EXISTS_FLAG}) = 0 ioctl(3, DM_TABLE_STATUS, {version=4.0.0, data_size=16384, data_start=312, dev=makedev(0xfd, 0), flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG} => {version=4.43.0, data_size=353, data_start=312, dev=makedev(0xfd, 0), name="crypt", uuid="CRYPT-LUKS1-c9 12d3ffa2a8470ca2d5b692dce44cf6-crypt", target_count=1, open_count=7, event_nr=0, flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_ACTIVE_PRESENT_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG, ...}) = 0 ioctl(4, BLKGETSIZE64, [510802264064]) = 0
[Kernel-packages] [Bug 1920821] Re: BLKDISCARD fails on LUKS volume hosting LVM PV
Reference 1 - Ubuntu kernel 5.11.0-11-generic: jak@jak-t480s:~:master$ sudo lvcreate -L 1G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo lvremove ubuntu-vg/foo Do you really want to remove and DISCARD active logical volume ubuntu-vg/foo? [y/n]: y /dev/mapper/crypt: BLKDISCARD ioctl at offset 72717697024 size 1073741824 failed: Device or resource busy. Logical volume "foo" successfully removed jak@jak-t480s:~:master$ uname -a Linux jak-t480s 5.11.0-11-generic #12-Ubuntu SMP Mon Mar 1 19:26:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920821 Title: BLKDISCARD fails on LUKS volume hosting LVM PV Status in Linux: Fix Released Status in linux package in Ubuntu: New Status in linux source package in Hirsute: New Bug description: Creating a logical volume and destroying it fails to discard the volume, on an encrypted installation. This can significantly increase wear on SSDs when a lot of LVs are created and destroyed. jak@jak-t480s:~:master$ sudo lvcreate -L 10G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo strace -e ioctl blkdiscard /dev/ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKDISCARD, [0, 10737418240]) = 0 +++ exited with 0 +++ jak@jak-t480s:~:master$ sudo strace -e ioctl lvremove ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [512110190592]) = 0 ioctl(3, BLKGETSIZE64, [119226368]) = 0 ioctl(3, DM_VERSION, {version=4.0.0, data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.43.0, data_size=16384, flags=DM_EXISTS_FLAG}) = 0 ioctl(3, DM_TABLE_STATUS, {version=4.0.0, data_size=16384, data_start=312, dev=makedev(0xfd, 0), flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG} => {version=4.43.0, data_size=353, data_start=312, dev=makedev(0xfd, 0), name="crypt", uuid="CRYPT-LUKS1-c9
[Kernel-packages] [Bug 1920821] Re: BLKDISCARD fails on LUKS volume hosting LVM PV
Let me try 5.11.6 and 5.11.7 mainline then... -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920821 Title: BLKDISCARD fails on LUKS volume hosting LVM PV Status in Linux: Fix Released Status in linux package in Ubuntu: New Status in linux source package in Hirsute: New Bug description: Creating a logical volume and destroying it fails to discard the volume, on an encrypted installation. This can significantly increase wear on SSDs when a lot of LVs are created and destroyed. jak@jak-t480s:~:master$ sudo lvcreate -L 10G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo strace -e ioctl blkdiscard /dev/ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKDISCARD, [0, 10737418240]) = 0 +++ exited with 0 +++ jak@jak-t480s:~:master$ sudo strace -e ioctl lvremove ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [512110190592]) = 0 ioctl(3, BLKGETSIZE64, [119226368]) = 0 ioctl(3, DM_VERSION, {version=4.0.0, data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.43.0, data_size=16384, flags=DM_EXISTS_FLAG}) = 0 ioctl(3, DM_TABLE_STATUS, {version=4.0.0, data_size=16384, data_start=312, dev=makedev(0xfd, 0), flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG} => {version=4.43.0, data_size=353, data_start=312, dev=makedev(0xfd, 0), name="crypt", uuid="CRYPT-LUKS1-c9 12d3ffa2a8470ca2d5b692dce44cf6-crypt", target_count=1, open_count=7, event_nr=0, flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_ACTIVE_PRESENT_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG, ...}) = 0 ioctl(4, BLKGETSIZE64, [510802264064]) = 0
[Kernel-packages] [Bug 1920821] Re: BLKDISCARD fails on LUKS volume hosting LVM PV
Hmm.. The referenced commit [1] is in 5.11.0-11 (which is based on stable 5.11.7). [1] commit 73dfbeb7fdb1c9f1f1dc991e3ea10f4c3fd8a7fb Author: Jan Kara Date: Mon Feb 22 10:48:09 2021 +0100 block: Try to handle busy underlying device on discard BugLink: https://bugs.launchpad.net/bugs/1919492 commit 56887cffe946bb0a90c74429fa94d6110a73119d upstream. Commit 384d87ef2c95 ("block: Do not discard buffers under a mounted filesystem") made paths issuing discard or zeroout requests to the underlying device try to grab block device in exclusive mode. If that failed we returned EBUSY to userspace. This however caused unexpected fallout in userspace where e.g. FUSE filesystems issue discard requests from userspace daemons although the device is open exclusively by the kernel. Also shrinking of logical volume by LVM issues discard requests to a device which may be claimed exclusively because there's another LV on the same PV. So to avoid these userspace regressions, fall back to invalidate_inode_pages2_range() instead of returning EBUSY to userspace and return EBUSY only of that call fails as well (meaning that there's indeed someone using the particular device range we are trying to discard). -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920821 Title: BLKDISCARD fails on LUKS volume hosting LVM PV Status in Linux: Fix Released Status in linux package in Ubuntu: New Status in linux source package in Hirsute: New Bug description: Creating a logical volume and destroying it fails to discard the volume, on an encrypted installation. This can significantly increase wear on SSDs when a lot of LVs are created and destroyed. jak@jak-t480s:~:master$ sudo lvcreate -L 10G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo strace -e ioctl blkdiscard /dev/ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKDISCARD, [0, 10737418240]) = 0 +++ exited with 0 +++ jak@jak-t480s:~:master$ sudo strace -e ioctl lvremove ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [512110190592]) = 0 ioctl(3, BLKGETSIZE64, [119226368]) = 0
[Kernel-packages] [Bug 1920821] Re: BLKDISCARD fails on LUKS volume hosting LVM PV
** Also affects: linux (Ubuntu Hirsute) Importance: Undecided Status: New -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920821 Title: BLKDISCARD fails on LUKS volume hosting LVM PV Status in Linux: Fix Released Status in linux package in Ubuntu: New Status in linux source package in Hirsute: New Bug description: Creating a logical volume and destroying it fails to discard the volume, on an encrypted installation. This can significantly increase wear on SSDs when a lot of LVs are created and destroyed. jak@jak-t480s:~:master$ sudo lvcreate -L 10G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo strace -e ioctl blkdiscard /dev/ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKDISCARD, [0, 10737418240]) = 0 +++ exited with 0 +++ jak@jak-t480s:~:master$ sudo strace -e ioctl lvremove ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [512110190592]) = 0 ioctl(3, BLKGETSIZE64, [119226368]) = 0 ioctl(3, DM_VERSION, {version=4.0.0, data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.43.0, data_size=16384, flags=DM_EXISTS_FLAG}) = 0 ioctl(3, DM_TABLE_STATUS, {version=4.0.0, data_size=16384, data_start=312, dev=makedev(0xfd, 0), flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG} => {version=4.43.0, data_size=353, data_start=312, dev=makedev(0xfd, 0), name="crypt", uuid="CRYPT-LUKS1-c9 12d3ffa2a8470ca2d5b692dce44cf6-crypt", target_count=1, open_count=7, event_nr=0, flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_ACTIVE_PRESENT_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG, ...}) = 0 ioctl(4, BLKGETSIZE64, [510802264064]) = 0
[Kernel-packages] [Bug 1920821] Re: BLKDISCARD fails on LUKS volume hosting LVM PV
** Changed in: linux Status: Unknown => Fix Released ** Changed in: linux Importance: Unknown => Medium -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920821 Title: BLKDISCARD fails on LUKS volume hosting LVM PV Status in Linux: Fix Released Status in linux package in Ubuntu: New Bug description: Creating a logical volume and destroying it fails to discard the volume, on an encrypted installation. This can significantly increase wear on SSDs when a lot of LVs are created and destroyed. jak@jak-t480s:~:master$ sudo lvcreate -L 10G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo strace -e ioctl blkdiscard /dev/ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKDISCARD, [0, 10737418240]) = 0 +++ exited with 0 +++ jak@jak-t480s:~:master$ sudo strace -e ioctl lvremove ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [512110190592]) = 0 ioctl(3, BLKGETSIZE64, [119226368]) = 0 ioctl(3, DM_VERSION, {version=4.0.0, data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.43.0, data_size=16384, flags=DM_EXISTS_FLAG}) = 0 ioctl(3, DM_TABLE_STATUS, {version=4.0.0, data_size=16384, data_start=312, dev=makedev(0xfd, 0), flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG} => {version=4.43.0, data_size=353, data_start=312, dev=makedev(0xfd, 0), name="crypt", uuid="CRYPT-LUKS1-c9 12d3ffa2a8470ca2d5b692dce44cf6-crypt", target_count=1, open_count=7, event_nr=0, flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_ACTIVE_PRESENT_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG, ...}) = 0 ioctl(4, BLKGETSIZE64, [510802264064]) = 0
[Kernel-packages] [Bug 1920821] Re: BLKDISCARD fails on LUKS volume hosting LVM PV
This seems to be https://bugzilla.kernel.org/show_bug.cgi?id=211167 ** Also affects: linux via https://bugzilla.kernel.org/show_bug.cgi?id=211167 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920821 Title: BLKDISCARD fails on LUKS volume hosting LVM PV Status in Linux: Unknown Status in linux package in Ubuntu: New Bug description: Creating a logical volume and destroying it fails to discard the volume, on an encrypted installation. This can significantly increase wear on SSDs when a lot of LVs are created and destroyed. jak@jak-t480s:~:master$ sudo lvcreate -L 10G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo strace -e ioctl blkdiscard /dev/ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKDISCARD, [0, 10737418240]) = 0 +++ exited with 0 +++ jak@jak-t480s:~:master$ sudo strace -e ioctl lvremove ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [512110190592]) = 0 ioctl(3, BLKGETSIZE64, [119226368]) = 0 ioctl(3, DM_VERSION, {version=4.0.0, data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.43.0, data_size=16384, flags=DM_EXISTS_FLAG}) = 0 ioctl(3, DM_TABLE_STATUS, {version=4.0.0, data_size=16384, data_start=312, dev=makedev(0xfd, 0), flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG} => {version=4.43.0, data_size=353, data_start=312, dev=makedev(0xfd, 0), name="crypt", uuid="CRYPT-LUKS1-c9 12d3ffa2a8470ca2d5b692dce44cf6-crypt", target_count=1, open_count=7, event_nr=0, flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_ACTIVE_PRESENT_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG, ...}) = 0 ioctl(4, BLKGETSIZE64, [510802264064]) = 0
[Kernel-packages] [Bug 1920821] Re: BLKDISCARD fails on LUKS volume hosting LVM PV
Should be fixed in 5.10.24, 5.11.7 and 5.12-rc3 according to the internet -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920821 Title: BLKDISCARD fails on LUKS volume hosting LVM PV Status in Linux: Unknown Status in linux package in Ubuntu: New Bug description: Creating a logical volume and destroying it fails to discard the volume, on an encrypted installation. This can significantly increase wear on SSDs when a lot of LVs are created and destroyed. jak@jak-t480s:~:master$ sudo lvcreate -L 10G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo strace -e ioctl blkdiscard /dev/ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKDISCARD, [0, 10737418240]) = 0 +++ exited with 0 +++ jak@jak-t480s:~:master$ sudo strace -e ioctl lvremove ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [512110190592]) = 0 ioctl(3, BLKGETSIZE64, [119226368]) = 0 ioctl(3, DM_VERSION, {version=4.0.0, data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.43.0, data_size=16384, flags=DM_EXISTS_FLAG}) = 0 ioctl(3, DM_TABLE_STATUS, {version=4.0.0, data_size=16384, data_start=312, dev=makedev(0xfd, 0), flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG} => {version=4.43.0, data_size=353, data_start=312, dev=makedev(0xfd, 0), name="crypt", uuid="CRYPT-LUKS1-c9 12d3ffa2a8470ca2d5b692dce44cf6-crypt", target_count=1, open_count=7, event_nr=0, flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_ACTIVE_PRESENT_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG, ...}) = 0 ioctl(4, BLKGETSIZE64, [510802264064]) = 0
[Kernel-packages] [Bug 1920821] Re: BLKDISCARD fails on LUKS volume hosting LVM PV
I verified that mainline ppa build 5.11.8-051108-generic works -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920821 Title: BLKDISCARD fails on LUKS volume hosting LVM PV Status in Linux: Unknown Status in linux package in Ubuntu: New Bug description: Creating a logical volume and destroying it fails to discard the volume, on an encrypted installation. This can significantly increase wear on SSDs when a lot of LVs are created and destroyed. jak@jak-t480s:~:master$ sudo lvcreate -L 10G -n foo ubuntu-vg Logical volume "foo" created. jak@jak-t480s:~:master$ sudo strace -e ioctl blkdiscard /dev/ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKGETSIZE64, [10737418240]) = 0 ioctl(3, BLKSSZGET, [512]) = 0 ioctl(3, BLKDISCARD, [0, 10737418240]) = 0 +++ exited with 0 +++ jak@jak-t480s:~:master$ sudo strace -e ioctl lvremove ubuntu-vg/foo ioctl(3, BLKGETSIZE64, [512110190592]) = 0 ioctl(3, BLKGETSIZE64, [119226368]) = 0 ioctl(3, DM_VERSION, {version=4.0.0, data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.43.0, data_size=16384, flags=DM_EXISTS_FLAG}) = 0 ioctl(3, DM_TABLE_STATUS, {version=4.0.0, data_size=16384, data_start=312, dev=makedev(0xfd, 0), flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG} => {version=4.43.0, data_size=353, data_start=312, dev=makedev(0xfd, 0), name="crypt", uuid="CRYPT-LUKS1-c9 12d3ffa2a8470ca2d5b692dce44cf6-crypt", target_count=1, open_count=7, event_nr=0, flags=DM_EXISTS_FLAG|DM_PERSISTENT_DEV_FLAG|DM_ACTIVE_PRESENT_FLAG|DM_SKIP_BDGET_FLAG|DM_NOFLUSH_FLAG, ...}) = 0 ioctl(4, BLKGETSIZE64, [510802264064]) = 0 ioctl(4,