diff options
Diffstat (limited to 'drivers/block/xen-blkback/xenbus.c')
-rw-r--r-- | drivers/block/xen-blkback/xenbus.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index c2014a0aa206..84973c6a856a 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -125,8 +125,10 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) | |||
125 | blkif->persistent_gnts.rb_node = NULL; | 125 | blkif->persistent_gnts.rb_node = NULL; |
126 | spin_lock_init(&blkif->free_pages_lock); | 126 | spin_lock_init(&blkif->free_pages_lock); |
127 | INIT_LIST_HEAD(&blkif->free_pages); | 127 | INIT_LIST_HEAD(&blkif->free_pages); |
128 | INIT_LIST_HEAD(&blkif->persistent_purge_list); | ||
128 | blkif->free_pages_num = 0; | 129 | blkif->free_pages_num = 0; |
129 | atomic_set(&blkif->persistent_gnt_in_use, 0); | 130 | atomic_set(&blkif->persistent_gnt_in_use, 0); |
131 | atomic_set(&blkif->inflight, 0); | ||
130 | 132 | ||
131 | INIT_LIST_HEAD(&blkif->pending_free); | 133 | INIT_LIST_HEAD(&blkif->pending_free); |
132 | 134 | ||
@@ -259,6 +261,17 @@ static void xen_blkif_free(struct xen_blkif *blkif) | |||
259 | if (!atomic_dec_and_test(&blkif->refcnt)) | 261 | if (!atomic_dec_and_test(&blkif->refcnt)) |
260 | BUG(); | 262 | BUG(); |
261 | 263 | ||
264 | /* Remove all persistent grants and the cache of ballooned pages. */ | ||
265 | xen_blkbk_free_caches(blkif); | ||
266 | |||
267 | /* Make sure everything is drained before shutting down */ | ||
268 | BUG_ON(blkif->persistent_gnt_c != 0); | ||
269 | BUG_ON(atomic_read(&blkif->persistent_gnt_in_use) != 0); | ||
270 | BUG_ON(blkif->free_pages_num != 0); | ||
271 | BUG_ON(!list_empty(&blkif->persistent_purge_list)); | ||
272 | BUG_ON(!list_empty(&blkif->free_pages)); | ||
273 | BUG_ON(!RB_EMPTY_ROOT(&blkif->persistent_gnts)); | ||
274 | |||
262 | /* Check that there is no request in use */ | 275 | /* Check that there is no request in use */ |
263 | list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) { | 276 | list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) { |
264 | list_del(&req->free_list); | 277 | list_del(&req->free_list); |