lkml.org 
[lkml]   [2000]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [FIX] Make deadlock detection work for file locking
Date
Andries Brouwer wrote:
> Nowhere any obligation.

Yes, it's always safe _not_ to return EDEADLK. Now when is it safe for
the kernel to return EDEADLK ? Maybe

- if the current process holds a lock and one of its threads is trying
to F_SETLKW a lock held by another process ? (POSIX.1 doesn't exclude
this.)
- if the current process holds a lock and one of its threads is trying
to F_SETLKW a lock held by another process which has a thread waiting
for the lock the current process holds ? (I.e. only look at processes,
not at threads - Solaris 2.5.1 seems to do this.)
- if the current thread is trying to F_SETLKW a lock, and waiting for
this lock would mean that there is a set of threads, where all threads
belonging to the processes of those threads are waiting for locks held
by one of those processes. (A real deadlock if we only consider the
locking system.)
- ditto, and none of the processes have alarm timers, or interval timers
running, which could generate a signal that will be caught. (A real
deadlock if we do not consider IO.)
- ditto, and none of the processes have asynchronous IO running, which
could generate a signal that will be caught. (A real deadlock if we do
not consider signals from other processes or from terminals.)
- ditto, and the processes have made no other provisions to receive
signals to unblock them, e.g. by telling a process not in the set of
blocked processes to send them a signal, or by making sure there's a
user who will get bored and hit ^C. (Perfect, but perhaps a little
hard to detect ;-)

Tricky, isn't it ? :-)

- Werner

--
_________________________________________________________________________
/ Werner Almesberger, ICA, EPFL, CH werner.almesberger@ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.073 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site