From: Bastian Blank <waldi@debian.org>
To: linux-lvm@redhat.com
Subject: [linux-lvm] Missing error handling in lv_snapshot_remove
Date: Tue, 6 Aug 2013 19:37:19 +0200 [thread overview]
Message-ID: <20130806173719.GB15184@mail.waldi.eu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 3832 bytes --]
Hi
I tried to tackle a particular bug that shows up in Debian for some time
now. Some blamed the udev rules and I still can't completely rule them
out. But this triggers a much worse bug in the error cleanup of the
snapshot remove. I reproduced this with Debian/Linux 3.2.46/LVM 2.02.99
without udevd running and Fedora 19/LVM 2.02.98-10.fc19.
On snapshot removal, LVM first converts the device into a regular LV
(lv_remove_snapshot) and in a second step removes this LV
(lv_remove_single). Is there a reason for this two step removal? An
error during removal leaves a non-snapshot LV behind.
I hold the cow device open so it will run into the error condition:
| $ sleep 100 < /dev/mapper/vg-test_snap-cow&
Then try to remove the LV:
| $ lvremove vg/test_snap
lv_remove_snapshot first suspends all devices:
| #metadata/lv_manip.c:4429 Removing snapshot test_snap
| #libdm-deptree.c:1314 Suspending vg-test_base (253:8) with device flush
| #ioctl/libdm-iface.c:1724 dm suspend (253:8) NFS [16384] (*1)
| #libdm-common.c:210 Suspended device counter increased to 1
| #ioctl/libdm-iface.c:1724 dm info (253:9) NF [16384] (*1)
| #libdm-deptree.c:1314 Suspending vg-test_snap (253:9) with device flush
| #ioctl/libdm-iface.c:1724 dm suspend (253:9) NFS [16384] (*1)
| #libdm-common.c:210 Suspended device counter increased to 2
| #ioctl/libdm-iface.c:1724 dm info (253:10) NF [16384] (*1)
| #libdm-deptree.c:1314 Suspending vg-test_base-real (253:10) with device flush
| #ioctl/libdm-iface.c:1724 dm suspend (253:10) NFS [16384] (*1)
| #libdm-common.c:210 Suspended device counter increased to 3
| #ioctl/libdm-iface.c:1724 dm info (253:11) NF [16384] (*1)
| #libdm-deptree.c:1314 Suspending vg-test_snap-cow (253:11) with device flush
| #ioctl/libdm-iface.c:1724 dm suspend (253:11) NFS [16384] (*1)
| #libdm-common.c:210 Suspended device counter increased to 4
Commits the VG:
| #format_text/format-text.c:735 Committing vg metadata (1276) to /dev/xvdb header@4096
Resumes three of the devices, but not vg-test_base:
| #libdm-deptree.c:1263 Resuming vg-test_snap-cow (253:11)
| #ioctl/libdm-iface.c:1724 dm resume (253:11) NF [16384] (*1)
| #libdm-common.c:1338 vg-test_snap-cow: Stacking NODE_ADD (253,11) 0:6 0660 [trust_udev]
| #libdm-common.c:1348 vg-test_snap-cow: Stacking NODE_READ_AHEAD 0 (flags=0)
| #libdm-common.c:221 Suspended device counter reduced to 3
| #libdm-deptree.c:1263 Resuming vg-test_base-real (253:10)
| #ioctl/libdm-iface.c:1724 dm resume (253:10) NF [16384] (*1)
| #libdm-common.c:1338 vg-test_base-real: Stacking NODE_ADD (253,10) 0:6 0660 [trust_udev]
| #libdm-common.c:1348 vg-test_base-real: Stacking NODE_READ_AHEAD 0 (flags=0)
| #libdm-common.c:221 Suspended device counter reduced to 2
| #libdm-deptree.c:1263 Resuming vg-test_snap (253:9)
| #ioctl/libdm-iface.c:1724 dm resume (253:9) NF [16384] (*1)
| #libdm-common.c:1338 vg-test_snap: Stacking NODE_ADD (253,9) 0:6 0660 [trust_udev]
| #libdm-common.c:1348 vg-test_snap: Stacking NODE_READ_AHEAD 256 (flags=1)
| #libdm-common.c:221 Suspended device counter reduced to 1
Now it fails to do lv_activate on the cow device, because it is still
open:
| #libdm-deptree.c:1562 Unable to deactivate open vg-test_snap-cow (253:11)
| #metadata/snapshot_manip.c:291 Failed to activate test_snap.
And exits without further error handling and with one suspended device:
| libdevmapper exiting with 1 device(s) still suspended.
Bastian
--
Beam me up, Scotty, there's no intelligent life down here!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next reply other threads:[~2013-08-06 17:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 17:37 Bastian Blank [this message]
2013-08-07 9:13 ` [linux-lvm] Missing error handling in lv_snapshot_remove Zdenek Kabelac
2013-08-07 12:36 ` Bastian Blank
2013-08-07 13:32 ` Alasdair G Kergon
2013-08-07 15:13 ` Zdenek Kabelac
2013-08-08 13:33 ` Ritesh Raj Sarraf
2013-08-09 9:50 ` Zdenek Kabelac
2013-08-07 9:22 ` Andreas Pflug
2013-08-07 9:41 ` Zdenek Kabelac
2013-08-07 17:18 ` Andreas Pflug
2013-08-08 10:01 ` Zdenek Kabelac
2013-08-09 7:57 ` Andreas Pflug
2013-08-09 9:40 ` Zdenek Kabelac
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130806173719.GB15184@mail.waldi.eu.org \
--to=waldi@debian.org \
--cc=linux-lvm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).