lkml.org 
[lkml]   [2000]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: isn't __brelse() wrong?
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/

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