proc 1/2: do PDE usecounting even for ->read_proc, ->write_proc
[safe/jmp/linux-2.6] / fs / proc / inode.c
index c6b4fa7..e11dc22 100644 (file)
@@ -35,16 +35,13 @@ struct proc_dir_entry *de_get(struct proc_dir_entry *de)
  */
 void de_put(struct proc_dir_entry *de)
 {
-       lock_kernel();
        if (!atomic_read(&de->count)) {
                printk("de_put: entry %s already free!\n", de->name);
-               unlock_kernel();
                return;
        }
 
        if (atomic_dec_and_test(&de->count))
                free_proc_entry(de);
-       unlock_kernel();
 }
 
 /*
@@ -106,14 +103,13 @@ static void init_once(void *foo)
        inode_init_once(&ei->vfs_inode);
 }
 
-int __init proc_init_inodecache(void)
+void __init proc_init_inodecache(void)
 {
        proc_inode_cachep = kmem_cache_create("proc_inode_cache",
                                             sizeof(struct proc_inode),
                                             0, (SLAB_RECLAIM_ACCOUNT|
                                                SLAB_MEM_SPREAD|SLAB_PANIC),
                                             init_once);
-       return 0;
 }
 
 static const struct super_operations proc_sops = {
@@ -131,7 +127,7 @@ static void __pde_users_dec(struct proc_dir_entry *pde)
                complete(pde->pde_unload_completion);
 }
 
-static void pde_users_dec(struct proc_dir_entry *pde)
+void pde_users_dec(struct proc_dir_entry *pde)
 {
        spin_lock(&pde->pde_unload_lock);
        __pde_users_dec(pde);
@@ -489,8 +485,10 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
                        }
                }
                unlock_new_inode(inode);
-       } else
+       } else {
               module_put(de->owner);
+              de_put(de);
+       }
        return inode;
 
 out_ino: