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

From: Andries Brouwer (aeb@veritas.com)
Date: Fri Aug 25 2000 - 08:02:34 EST


On Fri, Aug 25, 2000 at 12:16:23PM +0100, Alan Cox wrote:

> > I don't have POSIX in front of me, but I do not think
> > the system must detect deadlock. It is allowed to detect
> > deadlock, and in case it happens to do so EDEADLK is the
> > apprpriate error return.
>
> Do you know if SuS is that relaxed ?

POSIX is pretty relaxed already - no obligations at all,
except to return the proper error in case you happen to
detect that something is wrong.

The wording in SUSv2 and in the Austin draft are very similar.

[EDEADLK] Resource deadlock would occur.

[EDEADLK] Resource deadlock would occur. An attempt was made
to lock a system resource that would have resulted in a
deadlock situation.

On fcntl:
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.

The fcntl( ) function may fail if:
[EDEADLK] The cmd argument is F_SETLKW, the lock is blocked
by some lock from another process and putting the calling
process to sleep, waiting for that lock to become free would
cause a deadlock.

Since sleeping on a region is interrupted with any signal,
alarm( ) may be used to provide a timeout facility in applications
requiring it. This is useful in deadlock detection. Because
implementation of full deadlock detection is not always feasible,
the [EDEADLK] error was made optional.

On lockf:
A potential for deadlock occurs if the threads of a process
controlling a locked section are blocked by accessing another
process' locked section. If the system detects that deadlock
would occur, lockf ( ) shall fail with an [EDEADLK] error.
(etc.)

On pthread_join:
The pthread_join ( ) function may fail if:
[EDEADLK] A deadlock was detected or the value of thread
specifies the calling thread.

On sem_timedwait:
The sem_timedwait( ) function may fail if:
[EDEADLK] A deadlock condition was detected.

On sem_[try]wait:
The sem_trywait( ) and sem_wait( ) functions may fail if:
[EDEADLK] A deadlock condition was detected.

Nowhere any obligation.

Andries
-
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