Re: [FIX] Make deadlock detection work for file locking

From: Werner Almesberger (almesber@lrc.epfl.ch)
Date: Fri Aug 25 2000 - 08:47:46 EST


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/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:15 EST