From: Al Viro Date: Sat, 23 Aug 2025 06:06:57 +0000 (-0400) Subject: fs/namespace.c: allow to drop vfsmount references via __free(mntput) X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=547af12dcd43851a4894ffc3c60e381ab9f0f5e7;p=users%2Fhch%2Fmisc.git fs/namespace.c: allow to drop vfsmount references via __free(mntput) Note that just as path_put, it should never be done in scope of namespace_sem, be it shared or exclusive. Reviewed-by: Christian Brauner Signed-off-by: Al Viro --- diff --git a/fs/namespace.c b/fs/namespace.c index fcea65587ff9..767ab751ee2a 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -88,6 +88,8 @@ DEFINE_LOCK_GUARD_0(namespace_excl, namespace_lock(), namespace_unlock()) DEFINE_LOCK_GUARD_0(namespace_shared, down_read(&namespace_sem), up_read(&namespace_sem)) +DEFINE_FREE(mntput, struct vfsmount *, if (!IS_ERR(_T)) mntput(_T)) + #ifdef CONFIG_FSNOTIFY LIST_HEAD(notify_list); /* protected by namespace_sem */ #endif