Re: isn't __brelse() wrong?

From: Andrea Arcangeli (andrea@suse.de)
Date: Thu Mar 02 2000 - 15:12:40 EST


On Fri, 3 Mar 2000, Tigran Aivazian wrote:

> if (atomic_read(&buf->b_count)) {
> atomic_dec(&buf->b_count);
> return;
> }
>
>suggests that when the same buffer is brelse'd on two CPUs they both could
>get b_count=1 and decrement it thus causing negative b_count. I suppose I
>could write a tiny module creating two kernel_thread() which simply
>bread()/brelse() the same block from the same device in a reasonably busy
>loop to cause negative b_count. Btw, while we are on this subject, is it

That's not possible because if you are calling brelse b_count can only be
major than zero in all cases.

The check is useless and it's there to catch wrongly double releases.

>legal to create two instances of the "same" kernel thread, i.e. pass the
>same address as 'fn' parameter and internally distinguish the threads by
>current->pid?

Yes.

Andrea

-
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