public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]2.5.19:fs/locks.c
@ 2002-05-31 22:35 Saurabh Desai
  0 siblings, 0 replies; only message in thread
From: Saurabh Desai @ 2002-05-31 22:35 UTC (permalink / raw)
  To: torvalds, davej; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]


The following patch addresses problem associated with
process locks when called from the cloned process created 
with CLONE_THREAD flag. The fcntl locks are per-process and 
creates a dead-lock for cloned (w/CLONE_THREAD) processes.
It should use tgid instead pid (same way as getpid()).

Thanks,
Saurabh Desai  (sdesai@austin.ibm.com)
=======================================

[-- Attachment #2: fcntl_locks-2.5.19.diff --]
[-- Type: text/plain, Size: 1278 bytes --]

diff -Naur linux-2.5.19/fs/locks.c linux-2.5.19-patch/fs/locks.c
--- linux-2.5.19/fs/locks.c	Wed May 29 13:42:53 2002
+++ linux-2.5.19-patch/fs/locks.c	Fri May 31 13:24:12 2002
@@ -226,7 +226,7 @@
 
 	fl->fl_owner = NULL;
 	fl->fl_file = filp;
-	fl->fl_pid = current->pid;
+	fl->fl_pid = current->tgid;
 	fl->fl_flags = FL_FLOCK;
 	fl->fl_type = type;
 	fl->fl_start = 0;
@@ -285,7 +285,7 @@
 		fl->fl_end = OFFSET_MAX;
 	
 	fl->fl_owner = current->files;
-	fl->fl_pid = current->pid;
+	fl->fl_pid = current->tgid;
 	fl->fl_file = filp;
 	fl->fl_flags = FL_POSIX;
 	fl->fl_notify = NULL;
@@ -325,7 +325,7 @@
 		fl->fl_end = OFFSET_MAX;
 	
 	fl->fl_owner = current->files;
-	fl->fl_pid = current->pid;
+	fl->fl_pid = current->tgid;
 	fl->fl_file = filp;
 	fl->fl_flags = FL_POSIX;
 	fl->fl_notify = NULL;
@@ -354,7 +354,7 @@
 		return -ENOMEM;
 
 	fl->fl_owner = current->files;
-	fl->fl_pid = current->pid;
+	fl->fl_pid = current->tgid;
 
 	fl->fl_file = filp;
 	fl->fl_flags = FL_LEASE;
@@ -719,7 +719,7 @@
 		return -ENOMEM;
 
 	new_fl->fl_owner = current->files;
-	new_fl->fl_pid = current->pid;
+	new_fl->fl_pid = current->tgid;
 	new_fl->fl_file = filp;
 	new_fl->fl_flags = FL_POSIX | FL_ACCESS;
 	new_fl->fl_type = (read_write == FLOCK_VERIFY_WRITE) ? F_WRLCK : F_RDLCK;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-31 22:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-31 22:35 [PATCH]2.5.19:fs/locks.c Saurabh Desai

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