summaryrefslogtreecommitdiffstats
path: root/lib/device/dev-swap.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2011-05-28 09:48:14 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2011-05-28 09:48:14 +0000
commitc08c564e216834ddce5e6c97ee365bf763fb0781 (patch)
treecdc50c811a3756e905c96529c91a650a5ffced11 /lib/device/dev-swap.c
parent10c7d802a04b4f92b933a8fb287127370c424e72 (diff)
downloadlvm2-c08c564e216834ddce5e6c97ee365bf763fb0781.tar.gz
lvm2-c08c564e216834ddce5e6c97ee365bf763fb0781.tar.xz
lvm2-c08c564e216834ddce5e6c97ee365bf763fb0781.zip
Use new dev_open_readonly fn to prevent opening devices for read-write when not necessary.
Before, we used vg_write_lock_held call to determnine the way a device is opened. Unfortunately, this opened many devices in RW mode when it was not really necessary. With the OPTIONS+="watch" rule used in the udev rules, this could fire numerous events while closing such devices (and it caused useless scans from within udev rules in return). A common bug we hit with this was with the lvremove command which was unable to remove the LV since it was being opened from within the udev rules. This patch should minimize such situations (at least with respect to LVM handling of devices). Though there's still a possibility someone will open a device 'outside' in parallel and fire the event based on the watch rule when closing a device once opened for RW.
Diffstat (limited to 'lib/device/dev-swap.c')
-rw-r--r--lib/device/dev-swap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/device/dev-swap.c b/lib/device/dev-swap.c
index 287eafd7..f742bfe1 100644
--- a/lib/device/dev-swap.c
+++ b/lib/device/dev-swap.c
@@ -50,7 +50,7 @@ int dev_is_swap(struct device *dev, uint64_t *signature)
return -1;
}
- if (!dev_open(dev)) {
+ if (!dev_open_readonly(dev)) {
stack;
return -1;
}