mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-10 11:30:08 +01:00
[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 <[email protected]> Cc: Al Viro <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Michael Kerrisk <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Paul Mackerras <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
cf2e340f42
commit
99d1419d96
1 file changed
+6
-3
+6
-3
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user