This is just bd_openers, protected by the bd_mutex.
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
 
        mutex_unlock(&info->mutex);
 
-       if (!err)
-               ++info->users;
-
 out:
        unlock_kernel();
        return err;
        struct xenbus_device *xbdev;
 
        lock_kernel();
-       if (--info->users)
-               goto out;
 
        bdev = bdget_disk(disk, 0);
        bdput(bdev);
 
+       if (bdev->bd_openers)
+               goto out;
+
        /*
         * Check if we have been instructed to close. We will have
         * deferred this request, because the bdev was still open.
                kfree(info);
        }
 
-out:
        unlock_kernel();
        return 0;
 }