Skip to content

Commit

Permalink
hugetlbfs: remove unregister_filesystem() when initializing module
Browse files Browse the repository at this point in the history
It was introduced by d1d5e05 ("hugetlbfs: return error code when
initializing module") but as Al pointed out, is a 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."

So remove it.

Signed-off-by: Hillf Danton <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Hillf Danton authored and torvalds committed Apr 5, 2012
1 parent fd835d1 commit 7563ec4
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,6 @@ static int __init init_hugetlbfs_fs(void)
}

error = PTR_ERR(vfsmount);
unregister_filesystem(&hugetlbfs_fs_type);

out:
kmem_cache_destroy(hugetlbfs_inode_cachep);
Expand Down

0 comments on commit 7563ec4

Please sign in to comment.