New locking/refcounting for fs_struct
* all changes of current->fs are done under task_lock and write_lock of
old fs->lock
* refcount is not atomic anymore (same protection)
* its decrements are done when removing reference from current; at the
same time we decide whether to free it.
* put_fs_struct() is gone
* new field - ->in_exec. Set by check_unsafe_exec() if we are trying to do
execve() and only subthreads share fs_struct. Cleared when finishing exec
(success and failure alike). Makes CLONE_FS fail with -EAGAIN if set.
* check_unsafe_exec() may fail with -EAGAIN if another execve() from subthread
is in progress.
Signed-off-by:
Al Viro <viro@zeniv.linux.org.uk>
Showing
- fs/compat.c 14 additions, 2 deletionsfs/compat.c
- fs/exec.c 26 additions, 5 deletionsfs/exec.c
- fs/fs_struct.c 49 additions, 20 deletionsfs/fs_struct.c
- fs/internal.h 1 addition, 1 deletionfs/internal.h
- fs/proc/task_nommu.c 1 addition, 1 deletionfs/proc/task_nommu.c
- include/linux/fs_struct.h 3 additions, 5 deletionsinclude/linux/fs_struct.h
- kernel/fork.c 27 additions, 10 deletionskernel/fork.c
Loading
Please register or sign in to comment