Thread (16 messages) 16 messages, 3 authors, 2020-01-28

Re: [PATCH v7 07/11] proc: flush task dcache entries from all procfs instances

flat view

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2020-01-25 18:45:48
Also in: linux-fsdevel, linux-security-module, lkml

On Sat, Jan 25, 2020 at 5:06 AM Alexey Gladkov [off-list ref] wrote:
This allows to flush dcache entries of a task on multiple procfs mounts
per pid namespace.
From a quick read-through, this is the only one I really react negatively to.
The locking looks odd. It only seems to protect the new proc_mounts
list, but then it's a whole big rwsem, and it's taken over all of
proc_flush_task_mnt(), and the locking is exported to all over as a
result of that - including the dummy functions for "there is no proc"
case.

And proc_flush_task_mnt() itself should need no locking over any of
it, so it's all just for the silly looping over the list.

So

 (a) this looks fishy and feels wrong - I get a very strong feeling
that the locking is wrong to begin with, and could/should have been
done differently

 (b) all the locking should have been internal to /proc, and those
wrappers shouldn't exist in a common header file (and certainly not
for the non-proc case).

Yes, (a) is just a feeling, and I don't have any great suggestions.
Maybe make it an RCU list and use a spinlock for updating it?

But (b) is pretty much a non-starter in this form. Those wrappers
shouldn't be in a globally exported core header file. No way.

               Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help