public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -mm 6/9] unshare system call : allow unsharing of fs structure
@ 2005-12-13  3:00 JANAK DESAI
  2005-12-13 13:46 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: JANAK DESAI @ 2005-12-13  3:00 UTC (permalink / raw)
  To: viro, chrisw, dwmw2, jamie, serue, mingo, linuxram, jmorris, sds,
	janak
  Cc: akpm, linux-kernel


[PATCH -mm 6/9] unshare system call: allow unsharing of fs

 fork.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
 
 
diff -Naurp 2.6.15-rc5-mm2+patch/kernel/fork.c
2.6.15-rc5-mm2+patch6/kernel/fork.c
--- 2.6.15-rc5-mm2+patch/kernel/fork.c	2005-12-12 19:31:48.000000000
+0000
+++ 2.6.15-rc5-mm2+patch6/kernel/fork.c	2005-12-12 21:12:36.000000000
+0000
@@ -1378,15 +1378,19 @@ 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;
+	struct fs_struct *fs = current->fs, *new_fs;
 
 	if ((unshare_flags & CLONE_FS) &&
-	    (fs && atomic_read(&fs->count) > 1))
-		return -EINVAL;
+	    (fs && atomic_read(&fs->count) > 1)) {
+		new_fs = __copy_fs_struct(current->fs);
+		if (!new_fs)
+			return -ENOMEM;
+		*new_fsp = new_fs;
+	}
 
 	return 0;
 }



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -mm 6/9] unshare system call : allow unsharing of fs structure
  2005-12-13  3:00 [PATCH -mm 6/9] unshare system call : allow unsharing of fs structure JANAK DESAI
@ 2005-12-13 13:46 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2005-12-13 13:46 UTC (permalink / raw)
  To: JANAK DESAI
  Cc: chrisw, dwmw2, jamie, serue, mingo, linuxram, jmorris, sds, akpm,
	linux-kernel

On Mon, Dec 12, 2005 at 10:00:07PM -0500, JANAK DESAI wrote:
> +		new_fs = __copy_fs_struct(current->fs);
		*new_fsp = __copy_fs_struct(current->fs);

no need of local variables...

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-12-13 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-13  3:00 [PATCH -mm 6/9] unshare system call : allow unsharing of fs structure JANAK DESAI
2005-12-13 13:46 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox