[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YZ5A6iWLb0h3N3RC@bombadil.infradead.org>
Date: Wed, 24 Nov 2021 05:40:58 -0800
From: Luis Chamberlain <mcgrof@...nel.org>
To: Jan Kara <jack@...e.cz>
Cc: akpm@...ux-foundation.org, keescook@...omium.org,
yzaikin@...gle.com, nixiaoming@...wei.com, ebiederm@...ssion.com,
clemens@...isch.de, arnd@...db.de, gregkh@...uxfoundation.org,
jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
rodrigo.vivi@...el.com, tvrtko.ursulin@...ux.intel.com,
airlied@...ux.ie, benh@...nel.crashing.org, mark@...heh.com,
jlbec@...lplan.org, joseph.qi@...ux.alibaba.com,
amir73il@...il.com, phil@...lpotter.co.uk, viro@...iv.linux.org.uk,
julia.lawall@...ia.fr, ocfs2-devel@....oracle.com,
linuxppc-dev@...ts.ozlabs.org, intel-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 6/8] inotify: simplify subdirectory registration with
register_sysctl()
On Wed, Nov 24, 2021 at 10:44:09AM +0100, Jan Kara wrote:
> On Tue 23-11-21 12:24:20, Luis Chamberlain wrote:
> > From: Xiaoming Ni <nixiaoming@...wei.com>
> >
> > There is no need to user boiler plate code to specify a set of base
> > directories we're going to stuff sysctls under. Simplify this by using
> > register_sysctl() and specifying the directory path directly.
> >
> > Move inotify_user sysctl to inotify_user.c while at it to remove clutter
> > from kernel/sysctl.c.
> >
> > Signed-off-by: Xiaoming Ni <nixiaoming@...wei.com>
> > [mcgrof: update commit log to reflect new path we decided to take]
> > Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
>
> This looks fishy. You register inotify_table but not fanotify_table and
> remove both...
Indeed, the following was missing, I'll roll it in:
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 559bc1e9926d..a35693eb1f36 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -59,7 +59,7 @@ static int fanotify_max_queued_events __read_mostly;
static long ft_zero = 0;
static long ft_int_max = INT_MAX;
-struct ctl_table fanotify_table[] = {
+static struct ctl_table fanotify_table[] = {
{
.procname = "max_user_groups",
.data = &init_user_ns.ucount_max[UCOUNT_FANOTIFY_GROUPS],
@@ -88,6 +88,13 @@ struct ctl_table fanotify_table[] = {
},
{ }
};
+
+static void __init fanotify_sysctls_init(void)
+{
+ register_sysctl("fs/fanotify", fanotify_table);
+}
+#else
+#define fanotify_sysctls_init() do { } while (0)
#endif /* CONFIG_SYSCTL */
/*
@@ -1685,6 +1692,7 @@ static int __init fanotify_user_setup(void)
init_user_ns.ucount_max[UCOUNT_FANOTIFY_GROUPS] =
FANOTIFY_DEFAULT_MAX_GROUPS;
init_user_ns.ucount_max[UCOUNT_FANOTIFY_MARKS] = max_marks;
+ fanotify_sysctls_init();
return 0;
}
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index 616af2ea20f3..556cc63c88ee 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -5,8 +5,6 @@
#include <linux/sysctl.h>
#include <uapi/linux/fanotify.h>
-extern struct ctl_table fanotify_table[]; /* for sysctl */
-
#define FAN_GROUP_FLAG(group, flag) \
((group)->fanotify_data.flags & (flag))
Powered by blists - more mailing lists