blkfront: Lock blkfront_info when closing
authorDaniel Stodden <daniel.stodden@citrix.com>
Fri, 30 Apr 2010 22:01:19 +0000 (22:01 +0000)
committerJens Axboe <jaxboe@fusionio.com>
Sat, 7 Aug 2010 16:38:43 +0000 (18:38 +0200)
commitb70f5fa043b318659c936d8c3c696250e6528944
treeca627bca1a32250206d0af888b2c9e98a7a3c4ef
parenta66b5aebb7dc9e695dcb4b528906fd398b63f3d9
blkfront: Lock blkfront_info when closing

The bdev .open/.release fops race against backend switches to Closing,
handled by the XenBus thread.

The original code attempted to serialize block device holders and
xenbus only via bd_mutex. This is insufficient, the info->bd pointer
may already be stale (or null) while xenbus tries to bump up the
refcount.

Protect blkfront_info with a dedicated mutex.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
drivers/block/xen-blkfront.c