Always call blkdev_put when destroying a vbd in device backend
PATCH 1/1 Always call blkdev_put when destroying a vbd in device backend
The code for the block backend device in XenoLinux 2.6.8.1 doesn't call blkdev_put on all code paths that can destroy a vbd. Previously, blkdev_put was only called from vbd_shrink. I've added the call to vbd_destroy and destroy_all_vbds.
With the old code, the kernel running in domain-0 would believe the devices exported to another domain to still be in use, even after the other domain was shutdown. (This was obvious when using LVM, since the logical volumes were still listed as open, and a warning message was printed when shutting down LVM.) This patch should fix that.
--Michael Vrable
linux-2.6.8.1-xen-sparse/drivers/xen/blkback/vbd.c +6 -0
@@ -305,6 +305,9 @@while ( x !=NULL ) { t = x->next; +#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) +blkdev_put (x->bdev); +#endif kfree (x); x = t; }
@@ -330,6 +333,9 @@while ( x !=NULL ) { t = x->next; +#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) +blkdev_put (x->bdev); +#endif kfree (x); x = t; }
Quoted 10 lines · Michael Vrable
The code for the block backend device in XenoLinux 2.6.8.1 doesn't call
blkdev_puton all code paths that can destroy a vbd. Previously,blkdev_putwas only called fromvbd_shrink. I've added the call tovbd_destroyanddestroy_all_vbds.With the old code, the kernel running in domain-0 would believe the devices exported to another domain to still be in use, even after the other domain was shutdown. (This was obvious when using LVM, since the logical volumes were still listed as open, and a warning message was printed when shutting down LVM.) This patch should fix that.
Thanks. I've applied the patch.
christian
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
Quoted 6 lines · Christian Limpach
Quoted 5 lines · Michael Vrable
The code for the block backend device in XenoLinux 2.6.8.1 doesn't call
blkdev_puton all code paths that can destroy a vbd. Previously,blkdev_putwas only called fromvbd_shrink. I've added the call tovbd_destroyanddestroy_all_vbds.
Quoted 7 lines
Quoted 5 lines
With the old code, the kernel running in domain-0 would believe the devices exported to another domain to still be in use, even after the other domain was shutdown. (This was obvious when using LVM, since the logical volumes were still listed as open, and a warning message was printed when shutting down LVM.) This patch should fix that.
Thanks. I've applied the patch.
That patch is a bit ugly. Version checks scattered thruout the code is not something Linus likes.
Better to make a macro that expands to nothing when not needed, and place it in a header file.
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click