Skip to content

Commit b01d7cb

Browse files
committed
Merge tag 'for-linus-5.5b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross: "Two fixes: one for a resource accounting bug in some configurations and a fix for another patch which went into rc1" * tag 'for-linus-5.5b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/balloon: fix ballooned page accounting without hotplug enabled xen-blkback: prevent premature module unload
2 parents 2e6d304 + c673ec6 commit b01d7cb

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

drivers/block/xen-blkback/xenbus.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,15 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
171171
blkif->domid = domid;
172172
atomic_set(&blkif->refcnt, 1);
173173
init_completion(&blkif->drain_complete);
174+
175+
/*
176+
* Because freeing back to the cache may be deferred, it is not
177+
* safe to unload the module (and hence destroy the cache) until
178+
* this has completed. To prevent premature unloading, take an
179+
* extra module reference here and release only when the object
180+
* has been freed back to the cache.
181+
*/
182+
__module_get(THIS_MODULE);
174183
INIT_WORK(&blkif->free_work, xen_blkif_deferred_free);
175184

176185
return blkif;
@@ -320,6 +329,7 @@ static void xen_blkif_free(struct xen_blkif *blkif)
320329

321330
/* Make sure everything is drained before shutting down */
322331
kmem_cache_free(xen_blkif_cachep, blkif);
332+
module_put(THIS_MODULE);
323333
}
324334

325335
int __init xen_blkif_interface_init(void)

drivers/xen/balloon.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ static struct notifier_block xen_memory_nb = {
394394
#else
395395
static enum bp_state reserve_additional_memory(void)
396396
{
397-
balloon_stats.target_pages = balloon_stats.current_pages;
397+
balloon_stats.target_pages = balloon_stats.current_pages +
398+
balloon_stats.target_unpopulated;
398399
return BP_ECANCELED;
399400
}
400401
#endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */

0 commit comments

Comments
 (0)