linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saurabh Desai <sdesai@austin.ibm.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: [patch] thread-flock-2.5.38-A3
Date: Thu, 26 Sep 2002 13:48:05 -0500	[thread overview]
Message-ID: <3D935665.9EC43A6D@austin.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0209251030170.5122-100000@localhost.localdomain>

Ingo Molnar wrote:
> 
> 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').
> 
 
I had submitted same patch on May,31st and got the following
response from Matthew Wilcox. Removing the pid check from the
locks_same_owner() will fix this problem.

==================== Matthew Wilcox's response ====================
Saurabh Desai believes that locks created by threads should not conflict
with each other.  I'm inclined to agree; I don't know why the test for
->fl_pid was added, but the comment suggests that whoever added it wasn't
sure either.

Frankly, I have no clue about the intended semantics for threads, and
SUS v3 does not offer any enlightenment.  But it seems reasonable that
processes which share a files_struct should share locks.  After all,
if one process closes the fd, they'll remove locks belonging to the
other process.

Here's a patch generated against 2.4; it also applies to 2.5.
Please apply.

===== fs/locks.c 1.9 vs edited =====
--- 1.9/fs/locks.c      Mon Jun  3 18:49:43 2002
+++ edited/fs/locks.c   Fri Jun  7 21:24:12 2002
@@ -380,15 +380,12 @@
 }
 
 /*
- * Check whether two locks have the same owner
- * N.B. Do we need the test on PID as well as owner?
- * (Clone tasks should be considered as one "owner".)
+ * Locks are deemed to have the same owner if the tasks share files_struct.
  */
 static inline int
 locks_same_owner(struct file_lock *fl1, struct file_lock *fl2)
 {
-       return (fl1->fl_owner == fl2->fl_owner) &&
-              (fl1->fl_pid   == fl2->fl_pid);
+       return (fl1->fl_owner == fl2->fl_owner);
 }
 
 /* Remove waiter from blocker's block list.

      reply	other threads:[~2002-09-26 18:43 UTC|newest]

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

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=3D935665.9EC43A6D@austin.ibm.com \
    --to=sdesai@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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).