From: JANAK DESAI If filesystem structure is being shared, allocate a new one and copy information from the current, shared, structure. Signed-off-by: Janak Desai Cc: Signed-off-by: Andrew Morton --- kernel/fork.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff -puN kernel/fork.c~unshare-system-call-allow-unsharing-of-filesystem kernel/fork.c --- devel/kernel/fork.c~unshare-system-call-allow-unsharing-of-filesystem 2005-12-13 16:05:26.000000000 -0800 +++ devel-akpm/kernel/fork.c 2005-12-13 16:05:26.000000000 -0800 @@ -1366,15 +1366,18 @@ static int unshare_thread(unsigned long } /* - * 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; } _