Re: [ocfs2] c42ff46f97: sysctl_table_check_failed

From: Linus Torvalds
Date: Fri Jan 28 2022 - 03:06:34 EST


On Fri, Jan 28, 2022 at 8:53 AM kernel test robot <oliver.sang@xxxxxxxxx> wrote:
>
> commit: 46e33fd45a52bf03769906e64d8a8a1ab317777d ("ocfs2: simplify subdirectory
> registration with register_sysctl()")

Well, it's apparently commit c42ff46f97c1 ("ocfs2: simplify
subdirectory registration with register_sysctl()") in mainline now.

What worries me a bit is that the commit was auto-generated, and when
reading the commit message it reads as if it wasn't supposed to cause
any semantic changes at all.

Is the cause of this that 'nm' is supposed to be a directory, and
register_sysctl() doesn't handle directories?

I don't know this code at all, should it have been simplified even
further with something (TOTALLY UNTESTED) like the attached?

Linus
fs/ocfs2/stackglue.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index 731558a6f27d..dd77b7aaabf5 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -661,17 +661,6 @@ static struct ctl_table ocfs2_nm_table[] = {
{ }
};

-static struct ctl_table ocfs2_mod_table[] = {
- {
- .procname = "nm",
- .data = NULL,
- .maxlen = 0,
- .mode = 0555,
- .child = ocfs2_nm_table
- },
- { }
-};
-
static struct ctl_table_header *ocfs2_table_header;

/*
@@ -682,7 +671,7 @@ static int __init ocfs2_stack_glue_init(void)
{
strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB);

- ocfs2_table_header = register_sysctl("fs/ocfs2", ocfs2_mod_table);
+ ocfs2_table_header = register_sysctl("fs/ocfs2/nm", ocfs2_nm_table);
if (!ocfs2_table_header) {
printk(KERN_ERR
"ocfs2 stack glue: unable to register sysctl\n");