diff -urN -X dontdiff linux/arch/alpha/mm/extable.c 2327-p5-kcore/arch/alpha/mm/extable.c
--- linux/arch/alpha/mm/extable.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/alpha/mm/extable.c Wed Nov 10 09:17:05 1999
@@ -49,18 +49,13 @@
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
- read_lock(&modlist_lock);
for (mp = module_list; mp ; mp = mp->next) {
if (!mp->ex_table_start)
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end - 1, addr - mp->gp);
- if (ret) {
- read_unlock(&modlist_lock);
- return ret;
- }
+ if (ret) return ret;
}
- read_unlock(&modlist_lock);
#endif
return 0;
diff -urN -X dontdiff linux/arch/arm/mm/extable.c 2327-p5-kcore/arch/arm/mm/extable.c
--- linux/arch/arm/mm/extable.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/arm/mm/extable.c Wed Nov 10 09:17:22 1999
@@ -42,18 +42,13 @@
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
- read_lock(&modlist_lock);
for (mp = module_list; mp != NULL; mp = mp->next) {
if (mp->ex_table_start == NULL)
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end - 1, addr);
- if (ret) {
- read_unlock(&modlist_lock);
- return ret;
- }
+ if (ret) return ret;
}
- read_unlock(&modlist_lock);
#endif
return 0;
diff -urN -X dontdiff linux/arch/i386/mm/extable.c 2327-p5-kcore/arch/i386/mm/extable.c
--- linux/arch/i386/mm/extable.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/i386/mm/extable.c Wed Nov 10 09:17:36 1999
@@ -42,18 +42,13 @@
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
- read_lock(&modlist_lock);
for (mp = module_list; mp != NULL; mp = mp->next) {
if (mp->ex_table_start == NULL)
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end - 1, addr);
- if (ret) {
- read_unlock(&modlist_lock);
- return ret;
- }
+ if (ret) return ret;
}
- read_unlock(&modlist_lock);
#endif
return 0;
diff -urN -X dontdiff linux/arch/m68k/mm/extable.c 2327-p5-kcore/arch/m68k/mm/extable.c
--- linux/arch/m68k/mm/extable.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/m68k/mm/extable.c Wed Nov 10 09:17:50 1999
@@ -42,18 +42,13 @@
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
- read_lock(&modlist_lock);
for (mp = module_list; mp != NULL; mp = mp->next) {
if (mp->ex_table_start == NULL)
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end-1, addr);
- if (ret) {
- read_unlock(&modlist_lock);
- return ret;
- }
+ if (ret) return ret;
}
- read_unlock(&modlist_lock);
#endif
return 0;
diff -urN -X dontdiff linux/arch/mips/mm/extable.c 2327-p5-kcore/arch/mips/mm/extable.c
--- linux/arch/mips/mm/extable.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/mips/mm/extable.c Wed Nov 10 09:18:01 1999
@@ -41,18 +41,13 @@
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
- read_lock(&modlist_lock);
for (mp = module_list; mp != NULL; mp = mp->next) {
if (mp->ex_table_start == NULL)
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end - 1, addr);
- if (ret) {
- read_unlock(&modlist_lock);
- return ret;
- }
+ if (ret) return ret;
}
- read_unlock(&modlist_lock);
#endif
return 0;
diff -urN -X dontdiff linux/arch/ppc/mm/extable.c 2327-p5-kcore/arch/ppc/mm/extable.c
--- linux/arch/ppc/mm/extable.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/ppc/mm/extable.c Wed Nov 10 09:18:21 1999
@@ -43,18 +43,13 @@
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
- read_lock(&modlist_lock);
for (mp = module_list; mp != NULL; mp = mp->next) {
if (mp->ex_table_start == NULL)
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end - 1, addr);
- if (ret) {
- read_unlock(&modlist_lock);
- return ret;
- }
+ if (ret) return ret;
}
- read_unlock(&modlist_lock);
#endif
return 0;
diff -urN -X dontdiff linux/arch/sh/mm/extable.c 2327-p5-kcore/arch/sh/mm/extable.c
--- linux/arch/sh/mm/extable.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/sh/mm/extable.c Wed Nov 10 09:18:32 1999
@@ -45,18 +45,13 @@
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
- read_lock(&modlist_lock);
for (mp = module_list; mp != NULL; mp = mp->next) {
if (mp->ex_table_start == NULL)
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end - 1, addr);
- if (ret) {
- read_unlock(&modlist_lock);
- return ret;
- }
+ if (ret) return ret;
}
- read_unlock(&modlist_lock);
#endif
return 0;
diff -urN -X dontdiff linux/arch/sparc/mm/extable.c 2327-p5-kcore/arch/sparc/mm/extable.c
--- linux/arch/sparc/mm/extable.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/sparc/mm/extable.c Wed Nov 10 09:18:48 1999
@@ -56,18 +56,13 @@
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
- read_lock(&modlist_lock);
for (mp = module_list; mp != NULL; mp = mp->next) {
if (mp->ex_table_start == NULL)
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end-1, addr, g2);
- if (ret) {
- read_unlock(&modlist_lock);
- return ret;
- }
+ if (ret) return ret;
}
- read_unlock(&modlist_lock);
#endif
return 0;
diff -urN -X dontdiff linux/arch/sparc64/kernel/sys_sparc32.c 2327-p5-kcore/arch/sparc64/kernel/sys_sparc32.c
--- linux/arch/sparc64/kernel/sys_sparc32.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/sparc64/kernel/sys_sparc32.c Wed Nov 10 09:19:35 1999
@@ -2932,7 +2932,6 @@
free_page((unsigned long)buf);
}
-/* caller must hold modlist_lock at least in read mode */
static __inline__ struct module *find_module(const char *name)
{
struct module *mod;
@@ -3162,7 +3161,7 @@
struct module *mod;
int err;
- read_lock(&modlist_lock);
+ lock_kernel();
if (name_user == 0) {
/* This finds "kernel_module" which is not exported. */
for(mod = module_list; mod->next != NULL; mod = mod->next)
@@ -3212,7 +3211,7 @@
break;
}
out:
- read_unlock(&modlist_lock);
+ unlock_kernel();
return err;
}
diff -urN -X dontdiff linux/arch/sparc64/mm/extable.c 2327-p5-kcore/arch/sparc64/mm/extable.c
--- linux/arch/sparc64/mm/extable.c Wed Nov 10 08:49:02 1999
+++ 2327-p5-kcore/arch/sparc64/mm/extable.c Wed Nov 10 09:21:38 1999
@@ -56,18 +56,13 @@
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
- read_lock(&modlist_lock);
for (mp = module_list; mp != NULL; mp = mp->next) {
if (mp->ex_table_start == NULL)
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end-1, addr, g2);
- if (ret) {
- read_unlock(&modlist_lock);
- return ret;
- }
+ if (ret) return ret;
}
- read_unlock(&modlist_lock);
#endif
return 0;
diff -urN -X dontdiff linux/fs/proc/kcore.c 2327-p5-kcore/fs/proc/kcore.c
--- linux/fs/proc/kcore.c Wed Nov 10 08:49:06 1999
+++ 2327-p5-kcore/fs/proc/kcore.c Wed Nov 10 09:22:36 1999
@@ -211,7 +211,7 @@
#ifdef CONFIG_MODULES
{
struct module *m;
- read_lock(&modlist_lock);
+ lock_kernel();
for (m=module_list; m; m=m->next) {
dhdr = (struct elf_phdr *) bufp;
bufp += sizeof(struct elf_phdr);
@@ -227,7 +227,7 @@
dhdr->p_align = 0;
elf->e_phnum++;
}
- read_unlock(&modlist_lock);
+ lock_kernel();
}
#endif
diff -urN -X dontdiff linux/include/linux/module.h 2327-p5-kcore/include/linux/module.h
--- linux/include/linux/module.h Wed Nov 10 08:49:07 1999
+++ 2327-p5-kcore/include/linux/module.h Wed Nov 10 09:22:54 1999
@@ -287,6 +287,5 @@
#define EXPORT_NO_SYMBOLS
#endif /* MODULE */
-extern rwlock_t modlist_lock;
extern unsigned long get_kcore_size(void);
#endif /* _LINUX_MODULE_H */
diff -urN -X dontdiff linux/kernel/module.c 2327-p5-kcore/kernel/module.c
--- linux/kernel/module.c Wed Nov 10 08:49:07 1999
+++ 2327-p5-kcore/kernel/module.c Wed Nov 10 09:16:13 1999
@@ -13,7 +13,6 @@
* 0.99.14 version by Jon Tombs <
[email protected]>,
* Heavily modified by Bjorn Ekwall <
[email protected]> May 1994 (C)
* Rewritten by Richard Henderson <
[email protected]> Dec 1996
- * Use rw spinlock instead of global kernel lock for module_list, by TA <
[email protected]>
*
* This source is covered by the GNU GPL, the same as all kernel sources.
*/
@@ -53,8 +52,6 @@
static struct module *find_module(const char *name);
static void free_module(struct module *, int tag_freed);
-rwlock_t modlist_lock = RW_LOCK_UNLOCKED;
-
/* needed for /proc/kcore, here because kernel_module is static (TA) */
unsigned long get_kcore_size(void)
@@ -65,13 +62,13 @@
if (module_list == &kernel_module)
return ((unsigned long)high_memory - PAGE_OFFSET + PAGE_SIZE);
- read_lock(&modlist_lock);
+ lock_kernel();
for (m=module_list; m; m=m->next) {
try = (unsigned long)m + m->size;
if (try > size)
size = try;
}
- read_unlock(&modlist_lock);
+ unlock_kernel();
return (size - PAGE_OFFSET + PAGE_SIZE);
}
@@ -133,7 +130,7 @@
long namelen, error;
struct module *mod;
- write_lock(&modlist_lock);
+ lock_kernel();
if (!capable(CAP_SYS_MODULE)) {
error = -EPERM;
goto err0;
@@ -171,7 +168,7 @@
err1:
put_mod_name(name);
err0:
- write_unlock(&modlist_lock);
+ unlock_kernel();
return error;
}
@@ -188,7 +185,7 @@
unsigned long mod_user_size;
struct module_ref *dep;
- write_lock(&modlist_lock);
+ lock_kernel();
if (!capable(CAP_SYS_MODULE))
goto err0;
if ((namelen = get_mod_name(name_user, &name)) < 0) {
@@ -367,7 +364,7 @@
err1:
put_mod_name(name);
err0:
- write_unlock(&modlist_lock);
+ unlock_kernel();
return error;
}
@@ -379,7 +376,7 @@
long error = -EPERM;
int something_changed;
- write_lock(&modlist_lock);
+ lock_kernel();
if (!capable(CAP_SYS_MODULE))
goto out;
@@ -432,7 +429,7 @@
mod->flags &= ~MOD_JUST_FREED;
error = 0;
out:
- write_unlock(&modlist_lock);
+ unlock_kernel();
return error;
}
@@ -446,21 +443,17 @@
nmod = space = 0;
- read_lock(&modlist_lock);
for (mod=module_list; mod != &kernel_module; mod=mod->next, ++nmod) {
len = strlen(mod->name)+1;
if (len > bufsize)
goto calc_space_needed;
- if (copy_to_user(buf, mod->name, len)) {
- read_unlock(&modlist_lock);
+ if (copy_to_user(buf, mod->name, len))
return -EFAULT;
- }
buf += len;
bufsize -= len;
space += len;
}
- read_unlock(&modlist_lock);
if (put_user(nmod, ret))
return -EFAULT;
else
@@ -471,7 +464,6 @@
while ((mod = mod->next) != &kernel_module)
space += strlen(mod->name)+1;
- read_unlock(&modlist_lock);
if (put_user(space, ret))
return -EFAULT;
else
@@ -658,7 +650,7 @@
struct module *mod;
int err;
- read_lock(&modlist_lock);
+ lock_kernel();
if (name_user == NULL)
mod = &kernel_module;
else {
@@ -704,7 +696,7 @@
break;
}
out:
- read_unlock(&modlist_lock);
+ unlock_kernel();
return err;
}
@@ -723,7 +715,7 @@
int i;
struct kernel_sym ksym;
- read_lock(&modlist_lock);
+ lock_kernel();
for (mod = module_list, i = 0; mod; mod = mod->next) {
/* include the count for the module name! */
i += mod->nsyms + 1;
@@ -766,13 +758,12 @@
}
}
out:
- read_unlock(&modlist_lock);
+ unlock_kernel();
return i;
}
/*
* Look for a module by name, ignoring modules marked for deletion.
- * Callers must hold modlist_lock at least in read mode.
*/
static struct module *
@@ -792,7 +783,6 @@
/*
* Free the given module.
- * Callers must hold modlist_lock in exclusive (write) mode.
*/
static void
@@ -849,7 +839,6 @@
char tmpstr[64];
struct module_ref *ref;
- read_lock(&modlist_lock);
for (mod = module_list; mod != &kernel_module; mod = mod->next) {
long len;
const char *q;
@@ -915,7 +904,6 @@
}
fini:
- read_unlock(&modlist_lock);
return PAGE_SIZE - left;
}
@@ -932,7 +920,6 @@
off_t pos = 0;
off_t begin = 0;
- read_lock(&modlist_lock);
for (mod = module_list; mod; mod = mod->next) {
unsigned i;
struct module_symbol *sym;
@@ -967,7 +954,6 @@
len -= (offset - begin);
if (len > length)
len = length;
- read_unlock(&modlist_lock);
return len;
}
@@ -984,7 +970,6 @@
struct module_symbol *sym;
int i;
- read_lock(&modlist_lock);
for (mp = module_list; mp; mp = mp->next) {
if (((modname == NULL) || (strcmp(mp->name, modname) == 0)) &&
(mp->flags & (MOD_RUNNING | MOD_DELETED)) == MOD_RUNNING &&
@@ -993,13 +978,11 @@
i > 0; --i, ++sym) {
if (strcmp(sym->name, symname) == 0) {
- read_unlock(&modlist_lock);
return sym->value;
}
}
}
}
- read_unlock(&modlist_lock);
return 0;
}