From: bugzilla-daemon@bugzilla.kernel.org
To: linux-scsi@kernel.org
Subject: [Bug 195233] New: sd: discard_granularity set smaller than minimum_io_size when LBPRZ=1
Date: Mon, 03 Apr 2017 17:45:17 +0000 [thread overview]
Message-ID: <bug-195233-11613@https.bugzilla.kernel.org/> (raw)
https://bugzilla.kernel.org/show_bug.cgi?id=195233
Bug ID: 195233
Summary: sd: discard_granularity set smaller than
minimum_io_size when LBPRZ=1
Product: IO/Storage
Version: 2.5
Kernel Version: 4.4.0
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: SCSI
Assignee: linux-scsi@vger.kernel.org
Reporter: dbuckley@oreilly.com
Regression: No
Between 3.10 and 4.4 kernels this patch:
https://patchwork.kernel.org/patch/6995131/ was merged to ensure
discard_granularity is set to logical_block_size when a disk reports LBPRZ=1.
In a case where a disk reports LBPRZ=1 with a 512 logical_block_size and 4096
physical_block_size and minimum_io_size, this results in discard_granularity
incorrectly being set to 512 which at least in my case results in discard
requests being ignored.
I believe the easiest fix would be changing:
if (sdkp->lbprz) {
q->limits.discard_alignment = 0;
q->limits.discard_granularity = logical_block_size;
} else {
to:
if (sdkp->lbprz) {
q->limits.discard_alignment = 0;
q->limits.discard_granularity = max(logical_block_size,
minimum_io_size);
} else {
but any change which results in discard_granularity being set properly would
solve this.
I have verified that with a 3.10 kernel discard_granularity is set to 4096 and
works as expected, but with 4.4 it is set to 512 and does not work.
This is a fairly severe bug for my use case, as I rely on discard to free
unused blocks from the storage backing LUNs mounted by Linux clients and this
effectively makes critical functions like thin-provisioning and snapshots
infeasible for 4.x clients.
I have only tested this with the Ubuntu-packaged kernels, but the problematic
code still is present in the current source. I'm happy to provide any
additional information that might be helpful.
--
You are receiving this mail because:
You are the assignee for the bug.
reply other threads:[~2017-04-03 17:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=bug-195233-11613@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@bugzilla.kernel.org \
--cc=linux-scsi@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;
as well as URLs for NNTP newsgroup(s).