summaryrefslogtreecommitdiff
path: root/lib/device/dev-io.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2013-04-11 15:34:30 -0500
committerDavid Teigland <teigland@redhat.com>2013-04-11 15:48:07 -0500
commitd06d3239a4dcf30edd6baed84894bf91a6a2a10a (patch)
tree7e6d71355fbd6681d2f98de95ecf61c5f092f2a8 /lib/device/dev-io.c
parent07096b7058c78b65e0e37ace02346d77f6f9b854 (diff)
downloadlvm2-dev-dct-process.tar.gz
toollib: close vg devs after process_single_vgdev-dct-process
This test was failing at vg1: vgsplit-stacked.sh: vgchange -a n $vg $vg1 because a pv in $vg was an lv from $vg1, and because the devs in $vg were still open after processing $vg, the lv from $vg1 was still open, causing vgchange to fail on $vg1 with: Can't deactivate volume group "@PREFIX@vg1" with 1 open logical volume(s) I'm not sure that closing the devs this way is correct, because I've not been able to make sense of the way devices are closed otherwise. There seems to be a liberal sprinkling of dev_close_all(). I also don't see how the devs would have been closed before the recent changes, but apparently they were because this test was passing.
Diffstat (limited to 'lib/device/dev-io.c')
-rw-r--r--lib/device/dev-io.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 2846cafd9..be8523f36 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -623,6 +623,18 @@ int dev_close_immediate(struct device *dev)
return _dev_close(dev, 1);
}
+void dev_close_vg(const char *vgname)
+{
+ struct dm_list *doh, *doht;
+ struct device *dev;
+
+ dm_list_iterate_safe(doh, doht, &_open_devices) {
+ dev = dm_list_struct_base(doh, struct device, open_list);
+ if (dev->open_count < 1 && lvmcache_pvid_is_in_vg(dev->pvid, vgname))
+ _close(dev);
+ }
+}
+
void dev_close_all(void)
{
struct dm_list *doh, *doht;