linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: trond.myklebust@fys.uio.no
Cc: akpm@osdl.org, linux-fsdevel@vger.kernel.org, willy@debian.org
Subject: Re: Fw: Spam: [Bugme-new] [Bug 2829] New: posix_locks_deadlock() loops infinitely
Date: Sun, 6 Jun 2004 13:04:22 +1000	[thread overview]
Message-ID: <20040606130422.0c8946b3.sfr@canb.auug.org.au> (raw)
In-Reply-To: <200406050725.i557P3hQ004052@supreme.pcug.org.au>

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

On Sat, 5 Jun 2004 17:25:03 +1000 (EST) Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> At the moment we return false positives and false negatives (and
> apparently freeze solid under some circumstances), so we would be much
> better off not trying to do something that is possibly impossible for
> us to do anyway.
> 
> Besides which, the POSIX spec does not even talk about the interaction
> of POSIX files locks with POSIX thread as far as I can tell, so we are
> basically making up the semantics ...

Here's my (contrived) example:

Process P1 contains threads T1 and T2
Process P2

I am using "process id" and "thread id" in the POSIX sense.  These are
exclusive, whole file locks for simplicity.

T1 locks file F1 -> lock (P1, F1)
P2 locks file F2 -> lock (P2, F2)
P2 locks file F1 -> blocks against (P1, F1)
T1 locks file F2 -> blocks against (P2, F2)

Is this deadlocked?  If you use "process id" as the lock owner, then maybe.
Note that T2 is allowed to remove lock (P1, F1) ...
So if the OS said "deadlocked" then it may have given a false positive ...
If the OS didn't say "deadlocked" then it may have given a false negative ...
Whether there is a deadlock, is entirely up to the behaviour of the
application P1 and the OS cannot predict that ...

Of course, if you use "thread id" as the lock owner, the this is
definitely a deadlock.

Currently Linux (2.6) and Solaris(2.8) report deadlock when T1 tries to
lock F2.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-06-06  3:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-05  7:25 Fw: Spam: [Bugme-new] [Bug 2829] New: posix_locks_deadlock() loops infinitely Stephen Rothwell
2004-06-06  3:04 ` Stephen Rothwell [this message]
2004-06-06 13:27   ` Killing POSIX deadlock detection Matthew Wilcox
2004-06-06 19:49     ` Trond Myklebust
2004-06-06 20:09       ` Eric W. Biederman
2004-06-06 20:52         ` Trond Myklebust
  -- strict thread matches above, loose matches on Subject: below --
2004-06-05  3:32 Fw: Spam: [Bugme-new] [Bug 2829] New: posix_locks_deadlock() loops infinitely Stephen Rothwell
2004-06-05  3:29 Stephen Rothwell
2004-06-05  3:47 ` Trond Myklebust
2004-06-04  5:50 Andrew Morton
2004-06-04 11:20 ` Matthew Wilcox
2004-06-05  2:18   ` Andrew Morton
2004-06-05  2:45     ` Trond Myklebust
2004-06-05  3:36       ` Trond Myklebust

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=20040606130422.0c8946b3.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    --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;
as well as URLs for NNTP newsgroup(s).