lkml.org 
[lkml]   [2012]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH] hugetlbfs: add err code in initializing module
From
On Wed, Mar 28, 2012 at 3:24 PM, David Rientjes <rientjes@google.com> 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@gmail.com>
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@gmail.com>
---

--- 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);
--

\
 
 \ /
  Last update: 2012-03-28 14:43    [W:0.080 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site