From: Jens Axboe <axboe@suse.de>
To: Andrew Zabolotny <zap@homelink.ru>
Cc: linux-kernel@vger.kernel.org
Subject: Re: __make_request() bug and a fix variant
Date: Wed, 24 Sep 2003 11:21:30 +0200 [thread overview]
Message-ID: <20030924092130.GN1321@suse.de> (raw)
In-Reply-To: <20030920193626.31d2b8f5.zap@homelink.ru>
On Sat, Sep 20 2003, Andrew Zabolotny wrote:
> On Sat, 20 Sep 2003 13:37:37 +0200
> Jens Axboe <axboe@suse.de> wrote:
>
> > I dunno if you were the one posting this issue here some months ago?
> No, it wasn't me :-)
>
> > Show me a regular kernel path that passes invalid b_reqnext to
> > __make_request? That would be a bug, indeed, but I've never heard of
> > such a bug. Most likely it's a bug in your driver, not initialising
> > b_reqnext.
> I have been calling bread() which was causing me troubles. bread does
> not accept a buffer_head from outside, it gets a new one and returns it.
> So I don't have any control over b_reqnext field - the bug happens
> inside bread() between these lines:
>
> bh = getblk(dev, block, size);
> /* here bh_reqnext is already junk. In fact, I partially solved this
> problem by making my own clone of bread() and setting b_reqnext
> to NULL right here. But unfortunately, there is no guarantee we'll
> fix all invalid buffer_heads - maybe some remain in the pool and
> will be returned to other innocent drivers requesting them. */
> if (buffer_uptodate(bh))
> return bh;
> /* and now ll_rw_block will try to merge the bh with those already in
> the queue, and if it will take the ELEVATOR_NO_MERGE path, bh_reqnext
> will still remain junk. */
> ll_rw_block(READ, 1, &bh);
Looks very odd, there must be a bug elsewhere. What else is junk in the
bh?
It follows that if you submit a buffer_head for io, it must be properly
initialized for io. Nobody complains that if b_blocknr is crap that data
ends up in the wrong location. Likewise, b_reqnext must be initialized
to NULL.
> > You can see the initialisor for buffer_heads is
> > init_buffer_head, which memsets the entire buffer_head. When a
> > buffer_head is detached from the request list, b_reqnext is cleared
> > too.
> Ah, so I was correct that __make_request expects b_reqnext to be already
> set to NULL. In this case the bug should be somewhere else - in some
> code that returns buffer_head's back to the pool of buffers.
Exactly!
> Interesting that right before the driver crashes in bread() I call
> grok_partitions. I think the bug is somewhere there. I will do a new
> debug session at Monday (the code that breaks is at work), so I will
> post new details if I find any.
Please do.
--
Jens Axboe
next prev parent reply other threads:[~2003-09-24 9:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-19 19:17 __make_request() bug and a fix variant Andrew Zabolotny
2003-09-20 11:37 ` Jens Axboe
2003-09-20 15:36 ` Andrew Zabolotny
2003-09-20 15:47 ` Arjan van de Ven
2003-09-24 9:21 ` Jens Axboe [this message]
2003-09-24 19:37 ` Andrew Zabolotny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030924092130.GN1321@suse.de \
--to=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=zap@homelink.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.