Re: isn't __brelse() wrong?

From: Linus Torvalds (torvalds@transmeta.com)
Date: Fri Mar 03 2000 - 19:46:15 EST


In article <Pine.SCO.3.94.1000303160209.5282D-100000@tyne.london.sco.com>,
Tigran Aivazian <tigran@sco.COM> wrote:
>Hi guys,
>
>This is just a comment in passing as I am looking at some other code, but
>a glance at __brelse() which looks like this:
>
> if (atomic_read(&buf->b_count)) {
> atomic_dec(&buf->b_count);
> return;
> }

This is not a correctness issue: a correct usage of b_count will NEVER
allow anybody to decrement to a negative value.

The test is a debugging test, and as such race conditions aren't the
issue: it's there not to catch a race, but to catch potentially buggy
users who brelse() more than they ever meant to ;)

I don't think it has caught anybody in the last few years, but it's
certainly cheap enough, so..

                Linus

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



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:15 EST