public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Saurabh Desai <sdesai@austin.ibm.com>
To: Matthew Wilcox <willy@debian.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Linus Torvalds <torvalds@transmeta.com>,
	Marcelo Tosatti <marcelo@conectiva.com.br>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/locks.c: Fix posix locking for threaded tasks
Date: Wed, 12 Jun 2002 17:18:56 -0500	[thread overview]
Message-ID: <3D07C8D0.60B49C6D@austin.ibm.com> (raw)
In-Reply-To: <20020610034843.W27186@parcelfarce.linux.theplanet.co.uk> <E17I4bn-0007Rn-00@the-village.bc.nu> <20020612124536.T27449@parcelfarce.linux.theplanet.co.uk>

Matthew Wilcox wrote:
> 
> On Wed, Jun 12, 2002 at 10:40:07AM +0100, Alan Cox wrote:
> > > 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.
> >
> > This seems horribly inappropriate for 2.4 as it may break apps
> 
> I have no problem with withdrawing the request for 2.4.  It does mean that
> it's almost impossible to write an M:N threading library implementation.
> This doesn't concern me too much; I just want you to be aware this is
> the tradeoff you're making.
> 
> I would still like to see it in 2.5.

Yes, it's needed for M:N threading library. Here is scenario: Task A
holds a lock and waiting for some event in library, now task B tries
to acquire that lock and waits in kernel and this can create a deadlock.
These tasks are created with CLONE_THREAD (for M:N) flag. 
This change (removing pid check) may cause problem for 1:1 (linuxthreads),
where each task has unique pid and tgid. Again, whether that's a right 
behavior or not is questionable. 
However, with CLONE_THREAD flag, all tasks shares "tgid" value with unique
pid and that's why I suggested earlier to change the "fl_pid" from "pid" 
to "tgid" and it works for both the cases (M:N and 1:1).

  reply	other threads:[~2002-06-12 22:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-10  2:48 [PATCH] fs/locks.c: Fix posix locking for threaded tasks Matthew Wilcox
2002-06-10  6:41 ` 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 [this message]
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=3D07C8D0.60B49C6D@austin.ibm.com \
    --to=sdesai@austin.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@transmeta.com \
    --cc=willy@debian.org \
    /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