[Devel] [PATCH vz9] ve/vfs: restore filesystem related files in /proc/sys/fs

Alexander Atanasov alexander.atanasov at virtuozzo.com
Tue Jun 11 14:39:33 MSK 2024


odirect_enable, overflowuid and overflowgid entries are missing
from /proc/sys/fs directory.
Because fs/sysctls.c file is not included in the compilation.
The reason is broken Makefile
obj-$(CONFIG_SYSCTL)            += sysctls.o
obj-y := ....
file is first included but then there is an assignment and file
is not included anymore. To fix correct the order of adding and
setting object files.

next is initiallization - early_initcall is much too early.
switch to fs_initcall style like other files are registered in
/proc/sys/fs.

https://virtuozzo.atlassian.net/browse/PSBM-156472
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 fs/Makefile  | 3 ++-
 fs/sysctls.c | 9 +++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/Makefile b/fs/Makefile
index 2da0c7704758d..0085cc689ba3d 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -6,7 +6,6 @@
 # Rewritten to use lists instead of if-statements.
 # 
 
-obj-$(CONFIG_SYSCTL)		+= sysctls.o
 
 obj-y :=	open.o read_write.o file_table.o super.o \
 		char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
@@ -18,6 +17,8 @@ obj-y :=	open.o read_write.o file_table.o super.o \
 		fs_types.o fs_context.o fs_parser.o fsopen.o init.o \
 		kernel_read_file.o remap_range.o
 
+obj-$(CONFIG_SYSCTL)		+= sysctls.o
+
 ifeq ($(CONFIG_BLOCK),y)
 obj-y +=	buffer.o direct-io.o mpage.o
 else
diff --git a/fs/sysctls.c b/fs/sysctls.c
index 089755ccc5cda..990e8ac634c1e 100644
--- a/fs/sysctls.c
+++ b/fs/sysctls.c
@@ -6,6 +6,8 @@
  */
 #include <linux/init.h>
 #include <linux/sysctl.h>
+#include <linux/stat.h>
+#include <linux/ve.h>
 
 static struct ctl_table fs_shared_sysctls[] = {
 	{
@@ -36,11 +38,10 @@ static struct ctl_table fs_shared_sysctls[] = {
 	{ }
 };
 
-DECLARE_SYSCTL_BASE(fs, fs_shared_sysctls);
-
 static int __init init_fs_sysctls(void)
 {
-	return register_sysctl_base(fs);
+	register_sysctl_init("fs", fs_shared_sysctls);
+	return 0;
 }
 
-early_initcall(init_fs_sysctls);
+fs_initcall(init_fs_sysctls);
-- 
2.43.0



More information about the Devel mailing list