lkml.org 
[lkml]   [2001]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [CHECKER] a couple potential deadlocks in 2.4.5-ac8
Date
In article <19317.992115181@redhat.com>,
David Woodhouse <dwmw2@infradead.org> wrote:
>
>Obtaining a read lock twice can deadlock too, can't it?

If it does (with spinlocks), then that's an implementation bug (which
might well be there). We depend on the read-lock being recursive in a
lot of places, notably the fact that we don't disable interrupts while
holding read-locks if we know that the interrupt routines only take a
read-lock.

> A B
> read_lock()
> write_lock()
> ...sleeps...
> read_lock()
> ...sleeps...
>
>Or do we not make new readers sleep if there's a writer waiting?

The writer-waiter should not be spinning with the write lock held.

Note that the blocking versions are different, and I explicitly meant
only the read-spinlocks, not read-semaphores. For the semaphores I think
your schenario is indeed correct.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

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