[PATCH] mount: remove redundant panic() in mnt_init()

Hamza Mahfooz posted 1 patch 4 days, 14 hours ago
fs/namespace.c | 3 ---
1 file changed, 3 deletions(-)
[PATCH] mount: remove redundant panic() in mnt_init()
Posted by Hamza Mahfooz 4 days, 14 hours ago
Since at least as far back as commit 0818bf27c05b ("resizable
namespace.c hashes"), we call alloc_large_system_hash() in
mnt_init() which already panics if the table is NULL.

Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
---
 fs/namespace.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index fe919abd2f01..43de01ce023e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -6248,9 +6248,6 @@ void __init mnt_init(void)
 				HASH_ZERO,
 				&mp_hash_shift, &mp_hash_mask, 0, 0);
 
-	if (!mount_hashtable || !mountpoint_hashtable)
-		panic("Failed to allocate mount hash table\n");
-
 	kernfs_init();
 
 	err = sysfs_init();
-- 
2.55.0
Re: [PATCH] mount: remove redundant panic() in mnt_init()
Posted by Christian Brauner 2 days, 10 hours ago
On Mon, 20 Jul 2026 07:23:31 -0400, Hamza Mahfooz wrote:
> mount: remove redundant panic() in mnt_init()

Applied to the vfs-7.3.mount branch of the vfs/vfs.git tree.
Patches in the vfs-7.3.mount branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.3.mount

[1/1] mount: remove redundant panic() in mnt_init()
      https://git.kernel.org/vfs/vfs/c/083e8742e301
Re: [PATCH] mount: remove redundant panic() in mnt_init()
Posted by Jori Koolstra 4 days, 14 hours ago
On Mon, Jul 20, 2026 at 07:23:31AM -0400, Hamza Mahfooz wrote:
> Since at least as far back as commit 0818bf27c05b ("resizable
> namespace.c hashes"), we call alloc_large_system_hash() in
> mnt_init() which already panics if the table is NULL.
> 
> Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
> ---
>  fs/namespace.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index fe919abd2f01..43de01ce023e 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -6248,9 +6248,6 @@ void __init mnt_init(void)
>  				HASH_ZERO,
>  				&mp_hash_shift, &mp_hash_mask, 0, 0);
>  
> -	if (!mount_hashtable || !mountpoint_hashtable)
> -		panic("Failed to allocate mount hash table\n");
> -
>  	kernfs_init();
>  
>  	err = sysfs_init();
> -- 
> 2.55.0
> 

There isn't a reasonable way to return from this, and I see the other
uses of alloc_large_system_hash() also don't check for NULL, so this
is an OK clean-up.

Reviewed-by: Jori Koolstra <jkoolstra@xs4all.nl>