From: Matthew Wilcox <willy@debian.org>
To: Linus Torvalds <torvald@transmeta.com>,
Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: Saurabh Desai <sdesai@austin.ibm.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
linux-kernel@vger.kernel.org
Subject: [PATCH] fs/locks.c: Fix posix locking for threaded tasks
Date: Mon, 10 Jun 2002 03:48:43 +0100 [thread overview]
Message-ID: <20020610034843.W27186@parcelfarce.linux.theplanet.co.uk> (raw)
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.
--
Revolutions do not require corporate support.
next reply other threads:[~2002-06-10 2:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-10 2:48 Matthew Wilcox [this message]
2002-06-10 6:41 ` [PATCH] fs/locks.c: Fix posix locking for threaded tasks Andreas Dilger
2002-06-10 12:41 ` Matthew Wilcox
2002-06-10 20:30 ` Matthew Wilcox
2002-06-12 9:40 ` Alan Cox
2002-06-12 11:45 ` Matthew Wilcox
2002-06-12 22:18 ` Saurabh Desai
2002-06-12 22:33 ` Matthew Wilcox
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=20020610034843.W27186@parcelfarce.linux.theplanet.co.uk \
--to=willy@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=sdesai@austin.ibm.com \
--cc=sfr@canb.auug.org.au \
--cc=torvald@transmeta.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).