New locking/refcounting for fs_struct
commitd093166dbab62418c468481891cdfbc70e3c73f9
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 30 Mar 2009 11:20:30 +0000 (30 07:20 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 May 2009 22:45:08 +0000 (8 15:45 -0700)
treeb1670550e00462bd9e68c7933c0f0e839da786f2
parent83e8c55f17f8d55f755b8983e1192cf1e1f711cd
New locking/refcounting for fs_struct

commit 498052bba55ecaff58db6a1436b0e25bfd75a7ff upstream.

* 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/compat.c
fs/exec.c
fs/fs_struct.c
fs/internal.h
fs/proc/task_nommu.c
include/linux/fs_struct.h
kernel/fork.c