Skip to content

Commit

Permalink
[PATCH] unshare system call -v5: unshare filesystem info
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
JANAK DESAI authored and Linus Torvalds committed Feb 8, 2006
1 parent cf2e340 commit 99d1419
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -1371,15 +1371,18 @@ static int unshare_thread(unsigned long unshare_flags)
}

/*
* Unsharing of fs info for tasks created with CLONE_FS is not supported yet
* Unshare the filesystem structure if it is being shared
*/
static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp)
{
struct fs_struct *fs = current->fs;

if ((unshare_flags & CLONE_FS) &&
(fs && atomic_read(&fs->count) > 1))
return -EINVAL;
(fs && atomic_read(&fs->count) > 1)) {
*new_fsp = __copy_fs_struct(current->fs);
if (!*new_fsp)
return -ENOMEM;
}

return 0;
}
Expand Down

0 comments on commit 99d1419

Please sign in to comment.