Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198556
b: refs/heads/master
c: 578454f
h: refs/heads/master
v: v3
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed May 25, 2010
1 parent 38d7088 commit 0e1d404
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 218ce7351413b8287a80fab1d7b94906a5559f01
refs/heads/master: 578454ff7eab61d13a26b568f99a89a2c9edc881
2 changes: 2 additions & 0 deletions trunk/Documentation/devices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ Your cooperation is appreciated.
231 = /dev/snapshot System memory snapshot device
232 = /dev/kvm Kernel-based virtual machine (hardware virtualization extensions)
233 = /dev/kmview View-OS A process with a view
234 = /dev/btrfs-control Btrfs control device
235 = /dev/autofs Autofs control device
240-254 Reserved for local use
255 Reserved for MISC_DYNAMIC_MINOR

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/x86/kernel/microcode_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ static void microcode_dev_exit(void)
}

MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
MODULE_ALIAS("devname:cpu/microcode");
#else
#define microcode_dev_init() 0
#define microcode_dev_exit() do { } while (0)
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/ppp_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2926,5 +2926,5 @@ EXPORT_SYMBOL(ppp_output_wakeup);
EXPORT_SYMBOL(ppp_register_compressor);
EXPORT_SYMBOL(ppp_unregister_compressor);
MODULE_LICENSE("GPL");
MODULE_ALIAS_CHARDEV_MAJOR(PPP_MAJOR);
MODULE_ALIAS("/dev/ppp");
MODULE_ALIAS_CHARDEV(PPP_MAJOR, 0);
MODULE_ALIAS("devname:ppp");
1 change: 1 addition & 0 deletions trunk/drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -1649,3 +1649,4 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_AUTHOR(DRV_COPYRIGHT);
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(TUN_MINOR);
MODULE_ALIAS("devname:net/tun");
5 changes: 4 additions & 1 deletion trunk/fs/autofs4/dev-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,11 +736,14 @@ static const struct file_operations _dev_ioctl_fops = {
};

static struct miscdevice _autofs_dev_ioctl_misc = {
.minor = MISC_DYNAMIC_MINOR,
.minor = AUTOFS_MINOR,
.name = AUTOFS_DEVICE_NAME,
.fops = &_dev_ioctl_fops
};

MODULE_ALIAS_MISCDEV(AUTOFS_MINOR);
MODULE_ALIAS("devname:autofs");

/* Register/deregister misc character device */
int autofs_dev_ioctl_init(void)
{
Expand Down
5 changes: 4 additions & 1 deletion trunk/fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,14 @@ static const struct file_operations btrfs_ctl_fops = {
};

static struct miscdevice btrfs_misc = {
.minor = MISC_DYNAMIC_MINOR,
.minor = BTRFS_MINOR,
.name = "btrfs-control",
.fops = &btrfs_ctl_fops
};

MODULE_ALIAS_MISCDEV(BTRFS_MINOR);
MODULE_ALIAS("devname:btrfs-control");

static int btrfs_interface_init(void)
{
return misc_register(&btrfs_misc);
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/slab.h>

MODULE_ALIAS_MISCDEV(FUSE_MINOR);
MODULE_ALIAS("devname:fuse");

static struct kmem_cache *fuse_req_cachep;

Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/miscdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#define FUSE_MINOR 229
#define KVM_MINOR 232
#define VHOST_NET_MINOR 233
#define BTRFS_MINOR 234
#define AUTOFS_MINOR 235
#define MISC_DYNAMIC_MINOR 255

struct device;
Expand Down
59 changes: 37 additions & 22 deletions trunk/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,33 +563,26 @@ int use_module(struct module *a, struct module *b)
struct module_use *use;
int no_warn, err;

if (b == NULL || already_uses(a, b)) return 1;

/* If we're interrupted or time out, we fail. */
if (wait_event_interruptible_timeout(
module_wq, (err = strong_try_module_get(b)) != -EBUSY,
30 * HZ) <= 0) {
printk("%s: gave up waiting for init of module %s.\n",
a->name, b->name);
if (b == NULL || already_uses(a, b))
return 0;
}

/* If strong_try_module_get() returned a different error, we fail. */
/* If we're interrupted or time out, we fail. */
err = strong_try_module_get(b);
if (err)
return 0;
return err;

DEBUGP("Allocating new usage for %s.\n", a->name);
use = kmalloc(sizeof(*use), GFP_ATOMIC);
if (!use) {
printk("%s: out of memory loading\n", a->name);
module_put(b);
return 0;
return -ENOMEM;
}

use->module_which_uses = a;
list_add(&use->list, &b->modules_which_use_me);
no_warn = sysfs_create_link(b->holders_dir, &a->mkobj.kobj, a->name);
return 1;
return 0;
}
EXPORT_SYMBOL_GPL(use_module);

Expand Down Expand Up @@ -882,7 +875,7 @@ static inline void module_unload_free(struct module *mod)

int use_module(struct module *a, struct module *b)
{
return strong_try_module_get(b) == 0;
return strong_try_module_get(b);
}
EXPORT_SYMBOL_GPL(use_module);

Expand Down Expand Up @@ -1053,17 +1046,39 @@ static const struct kernel_symbol *resolve_symbol(Elf_Shdr *sechdrs,
struct module *owner;
const struct kernel_symbol *sym;
const unsigned long *crc;
DEFINE_WAIT(wait);
int err;
long timeleft = 30 * HZ;

again:
sym = find_symbol(name, &owner, &crc,
!(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);
/* use_module can fail due to OOM,
or module initialization or unloading */
if (sym) {
if (!check_version(sechdrs, versindex, name, mod, crc, owner)
|| !use_module(mod, owner))
sym = NULL;
}
return sym;
if (!sym)
return NULL;

if (!check_version(sechdrs, versindex, name, mod, crc, owner))
return NULL;

prepare_to_wait(&module_wq, &wait, TASK_INTERRUPTIBLE);
err = use_module(mod, owner);
if (likely(!err) || err != -EBUSY || signal_pending(current)) {
finish_wait(&module_wq, &wait);
return err ? NULL : sym;
}

/* Module is still loading. Drop lock and wait. */
mutex_unlock(&module_mutex);
timeleft = schedule_timeout(timeleft);
mutex_lock(&module_mutex);
finish_wait(&module_wq, &wait);

/* Module might be gone entirely, or replaced. Re-lookup. */
if (timeleft)
goto again;

printk(KERN_WARNING "%s: gave up waiting for init of module %s.\n",
mod->name, owner->name);
return NULL;
}

/*
Expand Down

0 comments on commit 0e1d404

Please sign in to comment.