Messages in this thread Patch in this message |  | | Date | Tue, 8 Jan 2002 15:56:51 -0500 (EST) | | From | Pavel Roskin <> | | Subject | binfmt_misc module gets stuck |
| |
Hello, Alexander!
I'm using Linux 2.4.18pre2 on i686. I compiled binfmt_misc as module. I can load it using modprobe but I cannot unload it.
I wrote some debugging code tracking how the use counter changes. It turns out that the call to kern_mount() in init_misc_binfmt() increases the counter when the module is loaded. kern_umount() is called when the module is unloaded, but this code cannot be executed before the use count becomes 0, which requires calling kern_umount().
I understand that kern_mount() is supposed to mount the filesystem. On the other hand, I scanned the LKML archives and found that /proc/sys/fs/binfmt_misc is supposed to be mounted from the userspace - it is no longer mounted by the kernel itself.
I believe that kern_mount() and kern_umount() are remnants from the time when the binfmt_misc filesystem was mounted automatically by the kernel. Removing them preserves all functionality (I did check it) while allows unloading binfmt_misc if and only if the binfmt_misc filesystem is not used for any mounts.
Here's the patch against 2.4.18pre2.
================================ --- linux.orig/fs/binfmt_misc.c +++ linux/fs/binfmt_misc.c @@ -693,16 +693,9 @@ static int __init init_misc_binfmt(void) { int err = register_filesystem(&bm_fs_type); if (!err) { - bm_mnt = kern_mount(&bm_fs_type); - err = PTR_ERR(bm_mnt); - if (IS_ERR(bm_mnt)) + err = register_binfmt(&misc_format); + if (err) { unregister_filesystem(&bm_fs_type); - else { - err = register_binfmt(&misc_format); - if (err) { - unregister_filesystem(&bm_fs_type); - kern_umount(bm_mnt); - } } } return err; @@ -712,7 +705,6 @@ static void __exit exit_misc_binfmt(void { unregister_binfmt(&misc_format); unregister_filesystem(&bm_fs_type); - kern_umount(bm_mnt); } EXPORT_NO_SYMBOLS; ================================ P.S. Similar patch should probaly be applied to fs/devpts/inode.c as well.
-- Regards, Pavel Roskin
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |