From: Mike Snitzer <snitzer@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
linux-kernel@vger.kernel.org,
Chris Mason <chris.mason@oracle.com>,
tj@kernel.org, Vivek Goyal <vgoyal@redhat.com>,
Jeff Moyer <jmoyer@redhat.com>
Subject: Re: elevator private data for REQ_FLUSH
Date: Fri, 25 Mar 2011 14:54:56 -0400 [thread overview]
Message-ID: <20110325185455.GA2969@redhat.com> (raw)
In-Reply-To: <4D8CB9C9.5010208@kernel.dk>
On Fri, Mar 25 2011 at 11:50am -0400,
Jens Axboe <axboe@kernel.dk> wrote:
> On 2011-03-25 16:40, Mike Snitzer wrote:
> > On Fri, Mar 25 2011 at 11:22am -0400,
> > Markus Trippelsdorf <markus@trippelsdorf.de> wrote:
> >
> >> On 2011.03.25 at 17:15 +0200, Sergey Senozhatsky wrote:
> >>> Hello,
> >>>
> >>> Commit
> >>> 9d5a4e946ce5352f19400b6370f4cd8e72806278
> >>> block: skip elevator data initialization for flush requests
> >>>
> >>> Skip elevator initialization for flush requests by passing priv=0 to
> >>> blk_alloc_request() in get_request(). As such elv_set_request() is
> >>> never called for flush requests.
> >>>
> >>> introduced priv flag, to skip elevator_private data init for FLUSH requests.
> >>> This, I guess, lead to NULL pointer deref on my machine in cfq_insert_request,
> >>> which requires elevator_private to be set:
> >>>
> >>> 1 [ 78.982169] Call Trace:
> >>> 2 [ 78.982178] [<ffffffff8122d1fe>] cfq_insert_request+0x4e/0x47d
> >>> 3 [ 78.982184] [<ffffffff8123e139>] ? do_raw_spin_lock+0x6b/0x122
> >>
> >>> Should we in that case use ELEVATOR_INSERT_FLUSH for REQ_FLUSH | REQ_FUA requests
> >>> (like below)?
> >>>
> >>> ---
> >>>
> >>> block/elevator.c | 2 ++
> >>> 1 files changed, 2 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/block/elevator.c b/block/elevator.c
> >>> index c387d31..b17e577 100644
> >>> --- a/block/elevator.c
> >>> +++ b/block/elevator.c
> >>> @@ -734,6 +734,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where)
> >>> q->end_sector = rq_end_sector(rq);
> >>> q->boundary_rq = rq;
> >>> }
> >>> + } else if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA)) {
> >>> + where = ELEVATOR_INSERT_FLUSH;
> >>> } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
> >>> where == ELEVATOR_INSERT_SORT)
> >>> where = ELEVATOR_INSERT_BACK;
> >>
> >> Thanks. That solves all (corruption-) problems that I reported earlier in an other
> >> thread.
> >
> > So the flush-merge changes introduced ELEVATOR_INSERT_FLUSH (via commit
> > ae1b1539). And the flush bio will now get ELEVATOR_INSERT_FLUSH in
> > __make_request().
> >
> > So it is interesting that the flush is getting inserted in the elevator
> > at all. AFAIK that shouldn't be (and historically hasn't been) the
> > case.
> >
> > Combination of onstack plug changes?
>
> It is, it forces a sort insert. I'll fix this up, I'm relieved we have a
> good handle on this issue now.
Should we also add a safety net to avoid the potential for future silent
corruption, etc? E.g.:
---
block/elevator.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index c387d31..86d258e 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -657,6 +657,9 @@ void elv_quiesce_end(struct request_queue *q)
void elv_insert(struct request_queue *q, struct request *rq, int where)
{
+ BUG_ON(rq->cmd_flags & (REQ_FLUSH | REQ_FUA) &&
+ where != ELEVATOR_INSERT_FLUSH);
+
trace_block_rq_insert(q, rq);
rq->q = q;
next prev parent reply other threads:[~2011-03-25 18:55 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 15:15 [OOPS] elevator private data for REQ_FLUSH Sergey Senozhatsky
2011-03-25 15:22 ` Markus Trippelsdorf
2011-03-25 15:40 ` Mike Snitzer
2011-03-25 15:50 ` Jens Axboe
2011-03-25 18:54 ` Mike Snitzer [this message]
2011-03-25 19:50 ` Jens Axboe
2011-03-26 4:21 ` Mike Snitzer
2011-03-28 8:23 ` Tejun Heo
2011-03-28 22:15 ` [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE (was: Re: elevator private data for REQ_FLUSH) Mike Snitzer
2011-03-29 11:56 ` [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE Jens Axboe
2011-03-29 14:18 ` Mike Snitzer
2011-03-29 18:25 ` [PATCH] " Christoph Hellwig
2011-03-30 7:42 ` Tejun Heo
2011-03-30 7:53 ` Jens Axboe
2011-03-29 14:13 ` [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE (was: Re: elevator private data for REQ_FLUSH) Jeff Moyer
2011-03-29 17:54 ` Vivek Goyal
2011-03-30 7:41 ` Tejun Heo
2011-03-30 7:57 ` Tejun Heo
2011-03-30 7:59 ` [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE Jens Axboe
2011-03-30 8:02 ` Tejun Heo
2011-03-30 10:16 ` Jens Axboe
2011-03-30 11:20 ` Tejun Heo
2011-03-30 11:23 ` Jens Axboe
2011-03-30 11:21 ` Sergey Senozhatsky
2011-03-30 11:22 ` Jens Axboe
2011-03-30 11:49 ` Sergey Senozhatsky
2011-03-30 13:46 ` Vivek Goyal
2011-03-30 13:49 ` Tejun Heo
2011-03-30 14:01 ` Mike Snitzer
2011-03-30 14:27 ` Tejun Heo
2011-03-30 15:22 ` Vivek Goyal
2011-03-30 15:30 ` Tejun Heo
2011-03-30 17:13 ` Jens Axboe
2011-03-30 17:32 ` Tejun Heo
2011-03-30 17:56 ` Jeff Moyer
2011-03-30 18:12 ` Jens Axboe
2011-03-25 15:57 ` [OOPS] elevator private data for REQ_FLUSH Jens Axboe
2011-03-25 16:03 ` Markus Trippelsdorf
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=20110325185455.GA2969@redhat.com \
--to=snitzer@redhat.com \
--cc=axboe@kernel.dk \
--cc=chris.mason@oracle.com \
--cc=jmoyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markus@trippelsdorf.de \
--cc=sergey.senozhatsky@gmail.com \
--cc=tj@kernel.org \
--cc=vgoyal@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox