linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: [patch] thread-flock-2.5.38-A3
Date: Wed, 25 Sep 2002 10:35:15 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0209251030170.5122-100000@localhost.localdomain> (raw)


Ulrich found another small detail wrt. POSIX requirements for threads -
this time it's the recursion features (read-held lock being write-locked
means an upgrade if the same 'process' is the owner, means a deadlock if a
different 'process').

this requirement even makes some sense - the group of threads who own a
lock really own all rights to the lock as well.

the attached patch against BK-curr fixes this, all testcases pass now.  
(inter-process testcases as well, which are not affected by this patch.)

(SIGURG and SIGIO semantics should also continue to work - there's some
more stuff we can optimize with the new pidhash in this area, but that's
for later.)

	Ingo

--- linux/fs/locks.c.orig	Wed Sep 25 10:28:26 2002
+++ linux/fs/locks.c	Wed Sep 25 10:28:41 2002
@@ -252,7 +252,7 @@
 		return -ENOMEM;
 
 	fl->fl_file = filp;
-	fl->fl_pid = current->pid;
+	fl->fl_pid = current->tgid;
 	fl->fl_flags = (cmd & LOCK_NB) ? FL_FLOCK : FL_FLOCK | FL_SLEEP;
 	fl->fl_type = type;
 	fl->fl_end = OFFSET_MAX;
@@ -308,7 +308,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;
@@ -348,7 +348,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;
@@ -377,7 +377,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;
@@ -669,7 +669,7 @@
 	int error;
 
 	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_ACCESS | FL_SLEEP;
 	fl.fl_type = (read_write == FLOCK_VERIFY_WRITE) ? F_WRLCK : F_RDLCK;
@@ -1241,7 +1241,7 @@
 	*before = fl;
 	list_add(&fl->fl_link, &file_lock_list);
 
-	error = f_setown(filp, current->pid, 1);
+	error = f_setown(filp, current->tgid, 1);
 out_unlock:
 	unlock_kernel();
 	return error;
@@ -1632,7 +1632,7 @@
 	lock.fl_start = 0;
 	lock.fl_end = OFFSET_MAX;
 	lock.fl_owner = owner;
-	lock.fl_pid = current->pid;
+	lock.fl_pid = current->tgid;
 	lock.fl_file = filp;
 
 	if (filp->f_op && filp->f_op->lock != NULL) {


             reply	other threads:[~2002-09-25  8:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-25  8:35 Ingo Molnar [this message]
2002-09-26 18:48 ` Saurabh Desai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0209251030170.5122-100000@localhost.localdomain \
    --to=mingo@elte.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --subject='Re: [patch] thread-flock-2.5.38-A3' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).