[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0710291002280.18815@twin.jikos.cz>
Date: Mon, 29 Oct 2007 10:11:13 +0100 (CET)
From: Jiri Kosina <jikos@...os.cz>
To: Matthew Wilcox <matthew@....cx>
cc: Trond Myklebust <trond.myklebust@....uio.no>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
"J. Bruce Fields" <bfields@...ldses.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
"George G. Davis" <gdavis@...sta.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org
Subject: Re: [RFC, PATCH] locks: remove posix deadlock detection
On Sun, 28 Oct 2007, Matthew Wilcox wrote:
> > A potential for deadlock occurs if a process controlling a locked
> > region is put to sleep by attempting to lock another process'
> > locked region. If the system detects that sleeping until a locked
> > region is unlocked would cause a deadlock, fcntl() shall fail with
> > an [EDEADLK] error.
> > This is what POSIX says [1], even after being modified with respect to
> > POSIX Threads Extension, right? So it doesn't deal with threads at
> > all, just processess are taken into account. Probably for a reason :)
> Did you have a concrete suggestion, or are you just quoting the spec?
I was quoting the spec and I thought that the suggestion is implicit --
the specification defines what happens only when processess are in place.
If the application uses POSIX threads in combination with locks, it is
going to receive undefined behavior.
> The problem is that it's nonsense -- processes don't sleep, threads do.
> I think the key is "would deadlock", not "might deadlock". Our current
> behaviour is clearly in violation of SuSv3.
- either we can add a special fcntl() Linux-specific flag, that will ask
the kernel not to perform deadlock detection. Any application that is
combining threads and posix locks (and thus IMHO asking for undefined
behavior) could use this flag and not receive EDEADLK any more
- or we can add some heuristics here-and-there to track which
current->files are shared and which are not, and do not return EDEADLK
in the case of shared ->files (could be a little bit tricky)
--
Jiri Kosina
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists