From: Jens Axboe <axboe@kernel.dk>
To: Mike Snitzer <snitzer@gmail.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>,
Adrian Hunter <adrian.hunter@nokia.com>,
linux-kernel Mailing List <linux-kernel@vger.kernel.org>,
stable@kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] block: prevent merges of discard and write requests
Date: Mon, 27 Sep 2010 15:08:21 +0900 [thread overview]
Message-ID: <4CA034D5.6090901@kernel.dk> (raw)
In-Reply-To: <AANLkTi==tc5q7tR0OZfBtvm1KMCbVO45LRHu6Em52bOy@mail.gmail.com>
On 2010-09-27 14:26, Mike Snitzer wrote:
> On Mon, Sep 27, 2010 at 1:12 AM, Mike Snitzer <snitzer@redhat.com> wrote:
>> On Mon, Sep 27, 2010 at 12:59 AM, Jens Axboe <axboe@kernel.dk> wrote:
>>> On 2010-09-27 12:30, Kyle McMartin wrote:
>>>> On Sat, Sep 25, 2010 at 12:40:48PM +0200, Jens Axboe wrote:
>>>>> On 2010-09-25 12:36, Adrian Hunter wrote:
>>>>>> Add logic to prevent two I/O requests being merged if
>>>>>> only one of them is a discard. Ditto secure discard.
>>>>>>
>>>>>> Without this fix, it is possible for write requests
>>>>>> to transform into discard requests. For example:
>>>>>>
>>>>>> Submit bio 1 to discard 8 sectors from sector n
>>>>>> Submit bio 2 to write 8 sectors from sector n + 16
>>>>>> Submit bio 3 to write 8 sectors from sector n + 8
>>>>>>
>>>>>> Bio 1 becomes request 1. Bio 2 becomes request 2.
>>>>>> Bio 3 is merged with request 2, and then subsequently
>>>>>> request 2 is merged with request 1 resulting in just
>>>>>> one I/O request which discards all 24 sectors.
>>>>>
>>>>> Wow, that's a disaster. We can now have requests in the
>>>>> same direction and of the same type (fs), but not mergeable.
>>>>>
>>>>> I would move the check up above the position calculations.
>>>>> I will apply this and upstream it right away. Thanks a lot!
>>>>>
>>>>
>>>> Jens, is this (the REQ_DISCARD hunk) required for stable as well? It
>>>> appears there's not much change relating to merging requests between
>>>> HEAD and v2.6.35, so I assume it is?
>>>
>>> No, 2.6.35 and earlier is safe, it's only 2.6.36-rc that is
>>> affected by this bug.
>>
>> I'm not so sure... I think 2.6.35 is affected. Jens, what do you hold
>> to be the regression point?
> ...
>> But things really broke once we started playing games with barrier
>> flags associated with discards. The regression point (relative to
>> discard merging) seems to have occurred when we got away from using
>> REQ_SOFTBARRIER with commit: fbbf055692aeb "block: fix DISCARD_BARRIER
>> requests". Which was still committed to v2.6.35...
>
> OK I take that back, with commit fbbf055692aeb REQ_HARDBARRIER is used
> for discards.. which is equally applicable to !rq_mergeable().
>
> Anyway, I'd still like to understand what you feel is the regression point.
Looking at the end result, 2.6.35 does look like it's affected for
request-to-request merges, if those were submitted outside of
blkdev_issue_discard() (all in-kernel users have BARRIER set). But we
can't rule out of-of-tree drivers, so I suppose we should submit
the patch to stable just to be on the safe side.
Thankfully it is a very rare condition. Request-to-request merges
are fairly uncommon, and the chance of an unrelated merge (most users do
waiting issues) is small. So it's affected in the same sense that .36-rc
is, I initially thought the problem was worse there.
--
Jens Axboe
prev parent reply other threads:[~2010-09-27 6:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-25 10:36 [PATCH] block: prevent merges of discard and write requests Adrian Hunter
2010-09-25 10:40 ` Jens Axboe
2010-09-27 3:30 ` Kyle McMartin
2010-09-27 4:59 ` Jens Axboe
2010-09-27 5:02 ` Kyle McMartin
2010-09-27 5:12 ` Mike Snitzer
2010-09-27 5:26 ` Mike Snitzer
2010-09-27 6:08 ` Jens Axboe [this message]
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=4CA034D5.6090901@kernel.dk \
--to=axboe@kernel.dk \
--cc=adrian.hunter@nokia.com \
--cc=hch@lst.de \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@gmail.com \
--cc=stable@kernel.org \
/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