Messages in this thread Patch in this message |  | | | Date | Thu, 27 Jul 2000 21:08:06 +0100 (BST) | | From | Tigran Aivazian <> | | Subject | Re: recent names_cachep change |
| |
On Thu, 27 Jul 2000, Alexander Viro wrote: > On Thu, 27 Jul 2000, Tigran Aivazian wrote: > > > Greetings Alexander, > > > > I am not sure if you have seen the recent discussion on linux-kernel about > > Ooopses in kmem_cache_alloc() which may suggest that there are users of > > getname() before names_cachep is created (due to module_init nature of > > namecache_init()). > > > > Have you given this some thought? I may be missing something obvious > > (e.g. you may have proved a theorem that _no_ getname() user is possible > > in principle before do_initcalls() is invoked?). > > Not my patch. Yes, such scenarios are possible. I'll try to look through > that stuff, but it certainly looks like namecache_init() must be moved to > the group of explicit cache initializations (in kernel/main.c). Linus, > your opinion? > Cheers, > Al
To make this discussion more specific, here is the patch (I haven't heard back from people who reported these oopses and I only did a _very_ brief analysis of the problem but the patch seems valid anyway).
diff -urN -X dontdiff linux/init/main.c work/init/main.c --- linux/init/main.c Thu Jul 27 07:31:21 2000 +++ work/init/main.c Thu Jul 27 21:04:35 2000 @@ -565,6 +565,7 @@ fork_init(mempages); filescache_init(); dcache_init(mempages); + namecache_init(); vma_init(); buffer_init(mempages); page_cache_init(mempages); diff -urN -X dontdiff linux/include/linux/fs.h work/include/linux/fs.h --- linux/include/linux/fs.h Thu Jul 27 07:31:21 2000 +++ work/include/linux/fs.h Thu Jul 27 21:04:06 2000 @@ -195,6 +195,7 @@ extern void inode_init(unsigned long); extern void file_table_init(void); extern void dcache_init(unsigned long); +extern void namecache_init(void); /* bh state bits */ #define BH_Uptodate 0 /* 1 if the buffer contains valid data */ diff -urN -X dontdiff linux/fs/namei.c work/fs/namei.c --- linux/fs/namei.c Thu Jul 27 07:31:19 2000 +++ work/fs/namei.c Thu Jul 27 21:04:29 2000 @@ -1958,7 +1958,7 @@ /* SLAB cache for name blocks */ kmem_cache_t *names_cachep; -static int __init namecache_init(void) +int __init namecache_init(void) { names_cachep = kmem_cache_create("names_cache", PAGE_SIZE, @@ -1969,5 +1969,3 @@ panic("Cannot create names cache"); return 0; } - -module_init(namecache_init)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
|  |