From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Coly Li <colyli@suse.de>,
Hannes Reinecke <hare@suse.com>, Xiao Ni <xni@redhat.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Evan Green <evgreen@chromium.org>,
Gwendal Grignou <gwendal@chromium.org>,
Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
Christoph Hellwig <hch@lst.de>,
stable@vger.kernel.org
Subject: Re: [PATCH RESEND] block: loop: set discard granularity and alignment for block device backed loop
Date: Mon, 17 Aug 2020 12:17:18 +0200 [thread overview]
Message-ID: <20200817101718.GC25336@lst.de> (raw)
In-Reply-To: <20200817100130.2496059-1-ming.lei@redhat.com>
On Mon, Aug 17, 2020 at 06:01:30PM +0800, Ming Lei wrote:
> In case of block device backend, if the backend supports write zeros, the
> loop device will set queue flag of QUEUE_FLAG_DISCARD. However,
> limits.discard_granularity isn't setup, and this way is wrong,
> see the following description in Documentation/ABI/testing/sysfs-block:
>
> A discard_granularity of 0 means that the device does not support
> discard functionality.
>
> Especially 9b15d109a6b2 ("block: improve discard bio alignment in
> __blkdev_issue_discard()") starts to take q->limits.discard_granularity
> for computing max discard sectors. And zero discard granularity may cause
> kernel oops, or fail discard request even though the loop queue claims
> discard support via QUEUE_FLAG_DISCARD.
>
> Fix the issue by setup discard granularity and alignment.
This patch looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
If you have a few spare cycles, can you kill QUEUE_FLAG_DISCARD and
just key off discard support based on checking discard_granularity to
avoid problems like this in the future?
next prev parent reply other threads:[~2020-08-17 10:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 10:01 [PATCH RESEND] block: loop: set discard granularity and alignment for block device backed loop Ming Lei
2020-08-17 10:17 ` Christoph Hellwig [this message]
2020-08-18 3:00 ` Martin K. Petersen
2020-08-17 13:58 ` Jens Axboe
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=20200817101718.GC25336@lst.de \
--to=hch@lst.de \
--cc=andrzej.p@collabora.com \
--cc=axboe@kernel.dk \
--cc=chaitanya.kulkarni@wdc.com \
--cc=colyli@suse.de \
--cc=evgreen@chromium.org \
--cc=gwendal@chromium.org \
--cc=hare@suse.com \
--cc=linux-block@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=stable@vger.kernel.org \
--cc=xni@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.