Re: Re-drive buffer head more than once

Jens Axboe (axboe@suse.de)
Fri, 2 May 2003 10:16:34 +0200


On Thu, May 01 2003, Zhihui Zhang wrote:
> Hi,
>
> Is it legal to call general_make_request() more than once on the same bh?
> What will happen if a previous request is still in the queue, or just
> initiated but not finished yet? If I call general_make_request() on the
> same buffer 10 times, does it mean the same buffer will *always* be
> written 10 times on the disk?

It's not legal to call generic_make_request() on a buffer_head, if you
have not acquired the BH_Lock first. The buffer_head will be unlocked on
IO completion, so that basically tells you that you cannot issue more
than _one_ generic_make_request() on a buffer_head.

If you fail to comply with that, then you will basically corrupt the
existing request in the queue where the buffer is attached. You _must_
do a lock_buffer() before calling generic_make_request.

-- 
Jens Axboe

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