Activity log for bug #2054131

Date Who What changed Old value New value Message
2024-02-16 16:27:31 Gunnar bug added bug
2024-02-16 16:27:31 Gunnar attachment added Bash script that reproduces the issue using a loopback device https://bugs.launchpad.net/bugs/2054131/+attachment/5746672/+files/reproducer.sh
2024-02-16 16:33:07 Gunnar bug watch added https://gitlab.com/lvmteam/lvm2/-/issues/10
2024-02-16 16:40:45 Gunnar description When attempting to remove multiple logical volumes (LVs) with the `lvremove -y` command, if any of the LVs are in use, the command fails but still causes the LVs to disappear from the system. However, these LVs reappear upon reactivating the volume group (VG), indicating they were not properly removed. This behavior can lead to confusion and inconsistent state of the VG and LVs. Expected behavior would either fully remove all not-in-use LVs or leave all LVs unchanged if any LV cannot be removed due to being in use. The expected behavior, observed in previous versions, was to fully remove all not-in-use LVs while leaving the ones that are in use unchanged. This regression in functionality can disrupt workflows that rely on lvremove to accurately reflect the state of LVs post-operation, leading to administrative confusion and potential data management issues. Environments: Affected: - LVM versions: LVM version: 2.03.16(2) (2022-05-18) Library version: 1.02.185 (2022-05-18) Driver version: 4.48.0 - Operating System: Ubuntu 23.10 Unaffected: - LVM versions: LVM version: 2.03.11(2) (2021-01-08) Library version: 1.02.175 (2021-01-08) Driver version: 4.48.0 - Operating System: Ubuntu 22.04 Script to Reproduce: ``` #!/bin/bash IFS=$'\n\t' set -euox pipefail echo ==== Setup cd $(mktemp -d) dd if=/dev/zero of=bug.img bs=1G count=1 loop=$(losetup -fP bug.img --show) pvcreate $loop vgcreate bug_vg $loop lvcreate -L 4M -n p1 bug_vg lvcreate -L 4M -n p2 bug_vg lvcreate -L 4M -n p3 bug_vg mkfs.fat /dev/mapper/bug_vg-p2 mkdir x mount /dev/mapper/bug_vg-p2 x echo ==== Setup done, bug_vg p2 is now in use lsblk $loop set +e # this command exits with exit code 5 lvremove -y /dev/bug_vg/* echo $? set -e lsblk $loop echo ==== Activate the vg again vgchange -aay bug_vg echo ==== Observe removed LVs are back lsblk $loop umount x rmdir x echo ==== bug_vg p2 is no longer in use, remove again lvremove -y /dev/bug_vg/* lsblk $loop echo ==== Activate the vg again vgchange -aay bug_vg echo ==== Observe removed LVs stay gone this time lsblk $loop echo cleanup vgremove bug_vg pvremove $loop losetup -d $loop rm bug.img ``` When attempting to remove multiple logical volumes (LVs) with the `lvremove -y` command, if any of the LVs are in use, the command fails but still causes the LVs to disappear from the system. However, these LVs reappear upon reactivating the volume group (VG), indicating they were not properly removed. This behavior can lead to confusion and inconsistent state of the VG and LVs. The expected behavior, observed in previous versions, was to fully remove all not-in-use LVs while leaving the ones that are in use unchanged. This regression in functionality can disrupt workflows that rely on lvremove to accurately reflect the state of LVs post-operation, leading to administrative confusion and potential data management issues. Environments:  Affected:   - LVM versions:    LVM version: 2.03.16(2) (2022-05-18)    Library version: 1.02.185 (2022-05-18)    Driver version: 4.48.0   - Operating System: Ubuntu 23.10  Unaffected:   - LVM versions:    LVM version: 2.03.11(2) (2021-01-08)    Library version: 1.02.175 (2021-01-08)    Driver version: 4.48.0   - Operating System: Ubuntu 22.04 Script to Reproduce: ``` #!/bin/bash IFS=$'\n\t' set -euox pipefail echo ==== Setup cd $(mktemp -d) dd if=/dev/zero of=bug.img bs=1G count=1 loop=$(losetup -fP bug.img --show) pvcreate $loop vgcreate bug_vg $loop lvcreate -L 4M -n p1 bug_vg lvcreate -L 4M -n p2 bug_vg lvcreate -L 4M -n p3 bug_vg mkfs.fat /dev/mapper/bug_vg-p2 mkdir x mount /dev/mapper/bug_vg-p2 x echo ==== Setup done, bug_vg p2 is now in use lsblk $loop set +e # this command exits with exit code 5 lvremove -y /dev/bug_vg/* echo $? set -e lsblk $loop echo ==== Activate the vg again vgchange -aay bug_vg echo ==== Observe removed LVs are back lsblk $loop umount x rmdir x echo ==== bug_vg p2 is no longer in use, remove again lvremove -y /dev/bug_vg/* lsblk $loop echo ==== Activate the vg again vgchange -aay bug_vg echo ==== Observe removed LVs stay gone this time lsblk $loop echo cleanup vgremove bug_vg pvremove $loop losetup -d $loop rm bug.img ```