Messages in this thread | | | Date | Sat, 11 Sep 1999 21:22:28 +0200 (CEST) | From | Andrea Arcangeli <> | Subject | Re: 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/
| |