diff options
author | Chunyan Liu <cyliu@novell.com> | 2010-12-13 17:39:27 +0000 |
---|---|---|
committer | Chunyan Liu <cyliu@novell.com> | 2010-12-13 17:39:27 +0000 |
commit | f662bb114a5d5ce24ce1cdcd0e36136c758ba5d7 (patch) | |
tree | 410953dea83b6b5a89f504a9c5be2215b1196b03 /tools/hotplug | |
parent | 999241f7aa459cfa20c6b122374eb4c62c10c5a9 (diff) | |
download | xen-f662bb114a5d5ce24ce1cdcd0e36136c758ba5d7.tar.gz xen-f662bb114a5d5ce24ce1cdcd0e36136c758ba5d7.tar.bz2 xen-f662bb114a5d5ce24ce1cdcd0e36136c758ba5d7.zip |
Fix /vm/uuid xenstore leak on tapdisk2 device cleanup
While doing block-detach blktap2 disk, tap2 device info is not cleared from
xenstore /vm/uuid/xxx. The reason is in xen-hotplug-cleanup script: when $vm_dev
does not exist, $(xenstore-read "$vm_dev" 2>/dev/null) is also "", won't enter
the block. So, change to use cmd return value to check existence.
Signed-off-by Chunyan Liu <cyliu@novell.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'tools/hotplug')
-rw-r--r-- | tools/hotplug/Linux/xen-hotplug-cleanup | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/hotplug/Linux/xen-hotplug-cleanup b/tools/hotplug/Linux/xen-hotplug-cleanup index 2b5a2b4590..237a2d1700 100644 --- a/tools/hotplug/Linux/xen-hotplug-cleanup +++ b/tools/hotplug/Linux/xen-hotplug-cleanup @@ -21,10 +21,12 @@ if [ "$vm" != "" ]; then # if the vm path does not exist and the device class is 'vbd' then we may have # a tap2 device - if [ "$(xenstore-read "$vm_dev" 2>/dev/null)" != "" ] \ - && [ "${path_array[1]}" = "vbd" ]; then - vm_dev="$vm/device/tap2/${path_array[3]}" - fi + $(xenstore-read "$vm_dev" 2>/dev/null) || \ + { + if [ "${path_array[1]}" = "vbd" ]; then + vm_dev="$vm/device/tap2/${path_array[3]}" + fi + } else vm_dev= fi |