Re: brlock_is_locked()?

From: Ben LaHaise (bcrl@redhat.com)
Date: Wed Aug 22 2001 - 11:33:21 EST


On Wed, 22 Aug 2001, Brad Chapman wrote:

> restart:
> if (brlock_is_locked(BR_NETPROTO_LOCK)) {
> CRITICAL_SECTION
> br_write_unlock_bh(BR_NETPROTO_LOCK);
> }
> else {
> /* Let's get dizzy */
> br_write_lock_bh(BR_NETPROTO_LOCK);
> goto restart;
> }

That code can never work. None of the linux spinlocks track ownership, so
checking if a lock is locked tells you if your process or another has
ownership of the lock. The above pseudo code is going to result in lots
of mangled data.

                -ben

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



This archive was generated by hypermail 2b29 : Thu Aug 23 2001 - 21:00:49 EST