From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>,
linux-xfs@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH] block: fix 32 bit overflow in __blkdev_issue_discard()
Date: Wed, 14 Nov 2018 18:51:47 -0700 [thread overview]
Message-ID: <80b9c4b7-1625-a1b6-0f1e-94de9d8b446b@kernel.dk> (raw)
In-Reply-To: <20181115010651.GD32603@ming.t460p>
On 11/14/18 6:06 PM, Ming Lei wrote:
> On Wed, Nov 14, 2018 at 08:18:24AM -0700, Jens Axboe wrote:
>> On 11/13/18 2:43 PM, Dave Chinner wrote:
>>> From: Dave Chinner <dchinner@redhat.com>
>>>
>>> A discard cleanup merged into 4.20-rc2 causes fstests xfs/259 to
>>> fall into an endless loop in the discard code. The test is creating
>>> a device that is exactly 2^32 sectors in size to test mkfs boundary
>>> conditions around the 32 bit sector overflow region.
>>>
>>> mkfs issues a discard for the entire device size by default, and
>>> hence this throws a sector count of 2^32 into
>>> blkdev_issue_discard(). It takes the number of sectors to discard as
>>> a sector_t - a 64 bit value.
>>>
>>> The commit ba5d73851e71 ("block: cleanup __blkdev_issue_discard")
>>> takes this sector count and casts it to a 32 bit value before
>>> comapring it against the maximum allowed discard size the device
>>> has. This truncates away the upper 32 bits, and so if the lower 32
>>> bits of the sector count is zero, it starts issuing discards of
>>> length 0. This causes the code to fall into an endless loop, issuing
>>> a zero length discards over and over again on the same sector.
>>
>> Applied, thanks. Ming, can you please add a blktests test for
>> this case? This is the 2nd time it's been broken.
>
> OK, I will add zram discard test in blktests, which should cover the
> 1st report. For the xfs/259, I need to investigate if it is easy to
> do in blktests.
null_blk has discard support, might be an easier target in terms
of blktests.
--
Jens Axboe
prev parent reply other threads:[~2018-11-15 1:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-13 21:43 [PATCH] block: fix 32 bit overflow in __blkdev_issue_discard() Dave Chinner
2018-11-14 2:36 ` Darrick J. Wong
2018-11-14 2:53 ` Ming Lei
2018-11-14 8:08 ` Dave Chinner
2018-11-14 8:15 ` Ming Lei
2018-11-14 15:18 ` Jens Axboe
2018-11-15 1:06 ` Ming Lei
2018-11-15 1:22 ` Dave Chinner
2018-11-15 3:10 ` Ming Lei
2018-11-15 22:13 ` Dave Chinner
2018-11-15 22:24 ` Darrick J. Wong
2018-11-16 4:04 ` Dave Chinner
2018-11-16 8:32 ` Christoph Hellwig
2018-11-16 8:46 ` Omar Sandoval
2018-11-16 8:53 ` Christoph Hellwig
2018-11-16 12:06 ` Ming Lei
2018-11-15 1:51 ` 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=80b9c4b7-1625-a1b6-0f1e-94de9d8b446b@kernel.dk \
--to=axboe@kernel.dk \
--cc=david@fromorbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ming.lei@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 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.