Re: [PATCH v2 1/1] dm-integrity: replace forgeable discard filler with a keyed sector marker

Mikulas Patocka <[email protected]> Mon, 3 Aug 2026 17:51:55 +0200 (CEST)
Newsgroups dev.linux.lists.dm-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On Fri, 31 Jul 2026, Milan Broz wrote:

> On 7/30/26 5:29 PM, Mikulas Patocka wrote:
> > Hi
> > 
> > I accepted the patch (and made some small modifications to it).
> 
> Mikulas, you added this part to constructor:
> 
> +	if (!!(ic->sb->flags & cpu_to_le32(SB_FLAG_DISCARD_KEYED)) !=
> ic->discard_keyed) {
> +		r = -EINVAL;
> +		ti->error = "Mismatch in the discard_keyed flag";
> +		goto bad;
> +	}
> 
> Unfortunately, this is not going to work.
> 
> In integritysetup, allowing discard is an active flag, not a format flag.
> It should be ok to activate discard later, but this check blocks it.
> It should also allow to activate the device without discard (even if it
> was activated before with it).
> 
> IMO, it should upgrade the superblock if allow_discards_keyed is set
> on activation (and then do not allow it to revert back).
> 
> With the current approach, I cannot add this option to integritysetup.
> We just have no way to send allow_discard in format action (as it is
> an activation flag only in our API).
> 
> Milan

OK.

I updated the patch at the top of the linux-dm repository, so that keyed 
discard can be set, but not disabled.

Mikulas