diff options
author | JANAK DESAI <janak@us.ibm.com> | 2006-02-07 15:58:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-07 19:12:34 -0500 |
commit | 99d1419d96d7df9cfa56bc977810be831bd5ef64 (patch) | |
tree | 994e2fe33cef91933d299af9c26ddb9a92da58f4 /kernel/fork.c | |
parent | cf2e340f4249b781b3d2beb41e891d08581f0e10 (diff) |
[PATCH] unshare system call -v5: unshare filesystem info
If filesystem structure is being shared, allocate a new one and copy
information from the current, shared, structure.
Signed-off-by: Janak Desai <janak@us.ibm.com>
Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Michael Kerrisk <mtk-manpages@gmx.net>
Cc: Andi Kleen <ak@muc.de>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 6eb9362775f9..598e5c27242c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1371,15 +1371,18 @@ static int unshare_thread(unsigned long unshare_flags) | |||
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | /* | 1373 | /* |
1374 | * Unsharing of fs info for tasks created with CLONE_FS is not supported yet | 1374 | * Unshare the filesystem structure if it is being shared |
1375 | */ | 1375 | */ |
1376 | static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp) | 1376 | static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp) |
1377 | { | 1377 | { |
1378 | struct fs_struct *fs = current->fs; | 1378 | struct fs_struct *fs = current->fs; |
1379 | 1379 | ||
1380 | if ((unshare_flags & CLONE_FS) && | 1380 | if ((unshare_flags & CLONE_FS) && |
1381 | (fs && atomic_read(&fs->count) > 1)) | 1381 | (fs && atomic_read(&fs->count) > 1)) { |
1382 | return -EINVAL; | 1382 | *new_fsp = __copy_fs_struct(current->fs); |
1383 | if (!*new_fsp) | ||
1384 | return -ENOMEM; | ||
1385 | } | ||
1383 | 1386 | ||
1384 | return 0; | 1387 | return 0; |
1385 | } | 1388 | } |