Linux-Integrity Archive mirror
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Eric Wheeler <linux-integrity@lists.ewheeler.net>,
	 Mike Snitzer <snitzer@kernel.org>
Cc: Milan Broz <gmazyland@gmail.com>,
	dm-devel@lists.linux.dev,  linux-integrity@vger.kernel.org
Subject: [PATCH] dm-integrity: set discard_granularity to logical block size
Date: Mon, 20 May 2024 16:48:31 +0200 (CEST)	[thread overview]
Message-ID: <d015c396-d686-48b1-1460-c8e1b18f4c4c@redhat.com> (raw)

dm-integrity could set discard_granularity lower than the logical block
size. This could result in failures when sending discard requests to
dm-integrity. This patch fixes discard_granularity.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Eric Wheeler <linux-integrity@lists.ewheeler.net>
Cc: stable@vger.kernel.org

---
 drivers/md/dm-integrity.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-integrity.c	2024-04-16 21:31:36.000000000 +0200
+++ linux-2.6/drivers/md/dm-integrity.c	2024-05-20 16:27:50.000000000 +0200
@@ -3492,6 +3492,7 @@ static void dm_integrity_io_hints(struct
 		limits->physical_block_size = ic->sectors_per_block << SECTOR_SHIFT;
 		blk_limits_io_min(limits, ic->sectors_per_block << SECTOR_SHIFT);
 		limits->dma_alignment = limits->logical_block_size - 1;
+		limits->discard_granularity = ic->sectors_per_block << SECTOR_SHIFT;
 	}
 	limits->max_integrity_segments = USHRT_MAX;
 }


             reply	other threads:[~2024-05-20 14:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 14:48 Mikulas Patocka [this message]
2024-05-20 15:02 ` [PATCH] dm-integrity: set discard_granularity to logical block size Christoph Hellwig

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=d015c396-d686-48b1-1460-c8e1b18f4c4c@redhat.com \
    --to=mpatocka@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=gmazyland@gmail.com \
    --cc=linux-integrity@lists.ewheeler.net \
    --cc=linux-integrity@vger.kernel.org \
    --cc=snitzer@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 read-only IMAP folder(s) and NNTP newsgroup(s).