Skip to content

Commit

Permalink
Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/rusty/linux

Pull module fixes and a virtio block fix from Rusty Russell:
 "Various minor fixes, but a slightly more complex one to fix the
  per-cpu overload problem introduced recently by kvm id changes."

* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  module: put modules in list much earlier.
  module: add new state MODULE_STATE_UNFORMED.
  module: prevent warning when finit_module a 0 sized file
  virtio-blk: Don't free ida when disk is in use
  • Loading branch information
Linus Torvalds committed Jan 21, 2013
2 parents 3a142ed + 1fb9341 commit 2263647
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 52 deletions.
7 changes: 6 additions & 1 deletion drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ static void virtblk_remove(struct virtio_device *vdev)
{
struct virtio_blk *vblk = vdev->priv;
int index = vblk->index;
int refc;

/* Prevent config work handler from accessing the device. */
mutex_lock(&vblk->config_lock);
Expand All @@ -903,11 +904,15 @@ static void virtblk_remove(struct virtio_device *vdev)

flush_work(&vblk->config_work);

refc = atomic_read(&disk_to_dev(vblk->disk)->kobj.kref.refcount);
put_disk(vblk->disk);
mempool_destroy(vblk->pool);
vdev->config->del_vqs(vdev);
kfree(vblk);
ida_simple_remove(&vd_index_ida, index);

/* Only free device id if we don't have any users */
if (refc == 1)
ida_simple_remove(&vd_index_ida, index);
}

#ifdef CONFIG_PM
Expand Down
10 changes: 5 additions & 5 deletions include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ struct module_use {
struct module *source, *target;
};

enum module_state
{
MODULE_STATE_LIVE,
MODULE_STATE_COMING,
MODULE_STATE_GOING,
enum module_state {
MODULE_STATE_LIVE, /* Normal state. */
MODULE_STATE_COMING, /* Full formed, running module_init. */
MODULE_STATE_GOING, /* Going away. */
MODULE_STATE_UNFORMED, /* Still setting it up. */
};

/**
Expand Down
2 changes: 2 additions & 0 deletions kernel/debug/kdb/kdb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,8 @@ static int kdb_lsmod(int argc, const char **argv)

kdb_printf("Module Size modstruct Used by\n");
list_for_each_entry(mod, kdb_modules, list) {
if (mod->state == MODULE_STATE_UNFORMED)
continue;

kdb_printf("%-20s%8u 0x%p ", mod->name,
mod->core_size, (void *)mod);
Expand Down
Loading

0 comments on commit 2263647

Please sign in to comment.