Re: [PATCH] hugetlbfs: add err code in initializing module
From: Hillf Danton
Date: Wed Mar 28 2012 - 08:40:21 EST
On Wed, Mar 28, 2012 at 3:24 PM, David Rientjes <rientjes@xxxxxxxxxx> wrote:
>
> The patch is still in linux-next as of yesterday's tree, so please propose
> a follow-up patch that removes the unregister_filesystem() since the
> setting of "error" when kmem_cache_create() is still correct.
Ah the window is still open.
Thanks
-hd
===cut here===
From: Hillf Danton <dhillf@xxxxxxxxx>
Subject: [PATCH] hugetlbfs: remove unregister_filesystem when
initializing module
It is introduced by
commit d1d5e05ffdc110021ae7937802e88ae0d223dcdc
hugetlbfs: return error code when initializing module
but as Al pointed out, is an example of bad idea.
Quoted comments from Al.
Note that unregister_filesystem() in module init is *always* wrong; it's not
an issue here (it's done too early to care about and realistically the box
is not going anywhere - it'll panic when attempt to exec /sbin/init fails,
if not earlier), but it's a damn bad example.
Consider a normal fs module. Somebody loads it and in parallel with that
we get a mount attempt on that fs type. It comes between register and
failure exits that causes unregister; at that point we are screwed since
grabbing a reference to module as done by mount is enough to prevent
exit, but not to prevent the failure of init. As the result, module will
get freed when init fails, mounted fs of that type be damned.
end of quote
So remove it.
Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
---
--- a/fs/hugetlbfs/inode.c Wed Mar 28 20:15:24 2012
+++ b/fs/hugetlbfs/inode.c Wed Mar 28 20:17:46 2012
@@ -1032,7 +1032,6 @@ static int __init init_hugetlbfs_fs(void
}
error = PTR_ERR(vfsmount);
- unregister_filesystem(&hugetlbfs_fs_type);
out:
kmem_cache_destroy(hugetlbfs_inode_cachep);
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/