lkml.org 
[lkml]   [1999]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Bug in __bforget()?
On Sat, 11 Sep 1999, Jan Kara wrote:

>The test looks like:
> if (!atomic_dec_and_test(&buf->b_count) || buffer_locked(buf))
> goto in_use;
>But I think it should be:
> if (atomic_dec_and_test(&buf->b_count)...))
> goto in_use;
>Because buffer is in use when it has b_count > 0 and now whne b_count == 0.

With in_use in such place we mean "in_use by somebody else too". When
bforget is called b_count is always >= 1. So if decreasing it make b_count
zero and so atomic_dec_and_test returned 1, then it means the buffer is
not in use by another user too and we can simply forgot it. If it's inuse
by sombody else too (atomic_dec_and_test returned zero) then we have to
take the brelse path.

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:53    [W:0.025 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site