Skip to contentSkip to conversation

ipc: always handle a new value of auto_msgmni

PATCH In review Andrey Vagin 3 participants 5 messages Aug 13, 2014 – Aug 19, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc: always handle a new value of auto_msgmni

proc_dointvec_minmax() returns zero, if a new value has been set. So we don't need to check all charectes have been handled.

Below you can find two examples. In the new value has not been handled properly.

$ strace ./a.out
open("/proc/sys/kernel/auto_msgmni", O_WRONLY) = 3
write(3, "0\n\0", 3)                    = 2
close(3)                                = 0
exit_group(0)
$ cat /sys/kernel/debug/tracing/trace

$strace ./a.out open("/proc/sys/kernel/auto_msgmni", O_WRONLY) = 3
write(3, "0\n", 2) = 2
close(3) = 0

$ cat /sys/kernel/debug/tracing/trace
a.out-697   [000] ....  3280.998235: unregister_ipcns_notifier <-proc_ipcauto_dointvec_minmax
Fixes 9eefe520c814 ("ipc: do not use a negative value to re-enable msgmni automatic recomputin")
Cc Andrew Morton <[email protected]>
Cc Mathias Krause <[email protected]>
Cc Manfred Spraul <[email protected]>
Cc Joe Perches <[email protected]>
Cc Davidlohr Bueso <[email protected]>
---
 ipc/ipc_sysctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
ipc/ipc_sysctl.c +1 -2
index c3f0326..e8075b2 100644
@@ -123,7 +123,6 @@ static int proc_ipcauto_dointvec_minmax(struct ctl_table *table, int write,
 	void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	struct ctl_table ipc_table;
-	size_t lenp_bef = *lenp;
 	int oldval;
 	int rc;
 
@@ -133,7 +132,7 @@ static int proc_ipcauto_dointvec_minmax(struct ctl_table *table, int write,
 
 	rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos);
 
-	if (write && !rc && lenp_bef == *lenp) {
+	if (write && !rc) {
 		int newval = *((int *)(ipc_table.data));
 		/*
 		 * The file "auto_msgmni" has correctly been set.
Signature · 1 line
1.9.3
#1 lore raw

Hi Andrey,

Quoted 2 lines · Andrey Vagin

proc_dointvec_minmax() returns zero, if a new value has been set. So we don't need to check all charectes have been handled.

What do you use auto_msgmni for?

I would propose to remove the whole logic - just always allow 32000 message queues.

--
Manfred

#2 lore raw
Quoted 6 lines · Manfred Spraul

Hi Andrey,

Quoted 2 lines · Andrey Vagin

proc_dointvec_minmax() returns zero, if a new value has been set. So we don't need to check all charectes have been handled.

What do you use auto_msgmni for?

We disable it to check that criu restores a value of the msgmni sysctl correctly.

https://github.com/xemul/criu/blob/master/test/zdtm/live/static/ipc_namespace.c

Quoted 3 lines

I would propose to remove the whole logic - just always allow 32000 message queues.

I don't have objections.

Quoted 3 lines

--
Manfred

#3 lore raw

Hi Andrew,

Quoted 8 lines · Andrew Vagin
Quoted 4 lines · Manfred Spraul

Hi Andrey,

[...]
What do you use auto_msgmni for?

We disable it to check that criu restores a value of the msgmni sysctl correctly.

https://github.com/xemul/criu/blob/master/test/zdtm/live/static/ipc_namespace.c

Thanks for the link, if I see it right, my patch would break your code:

http://marc.info/?l=linux-kernel&m=140782863804950

It removes auto_msgmni - and
What do you think, should I leave auto_msgmni as a stale variable, perhaps with a pr_info() that it doesn't have any effect?

--
Manfred

#4 lore raw
Quoted 10 lines · Manfred Spraul

Hi Andrew,

Quoted 7 lines · Andrew Vagin
Quoted 4 lines · Manfred Spraul

Hi Andrey,

[...]
What do you use auto_msgmni for?

We disable it to check that criu restores a value of the msgmni sysctl correctly.

Quoted 8 lines
Quoted 1 line

https://github.com/xemul/criu/blob/master/test/zdtm/live/static/ipc_namespace.c

Thanks for the link, if I see it right, my patch would break your code:

http://marc.info/?l=linux-kernel&m=140782863804950

It removes auto_msgmni - and
What do you think, should I leave auto_msgmni as a stale variable, perhaps with a pr_info() that it doesn't have any effect?

Yes, you should. For example "criu restore" will start failing, if you remove auto_msgmni.

Quoted 4 lines

--
Manfred