From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385590; b=fmbqPlOZGgz+WXT2LbpKVSQxXrXSA/6TtWu1eQ2LuhirbamwhZBU8W8yc1B8lTgQrhMk D+MU43MKXB+gKKzIw+Yxf9GpSDmInjFCfhhI4avjD4XOZN+AcI2WSR82OLrUmKMJwjvSr phlTCvl6ACxHjOPYGDqm1R19TdNN2HDbtKKJZWyJsTxoMtx0db9eHIpcD8X3j8fktD+Kn tuzBEk7fRwRWIq1mwcCX7F+9OGRsL53WXk5pgAT1qX6GK6PpLfWt0Dxkbr3LUCZ98NBY5 2tz9dH7TeEHN/CLVltervz1lZF6I5j008bw7JXXEnFqe9DjJJEJ13SsuYGWfkkfJk4Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385590; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=heRiY6l06TpYjX5T79LPrSIJtBB1vsQu8KUpTvLksr0=; b=AWUQugxVEdFuFZINjF+uO3kdffxtIN0ly2NPzku7EiKryXuUOKbNEmc5qr8gS5kWW78C OVUsmsqQlxXac+0o6X0WuwMA33hAP5OkEQMTvKAwVDEVBuZ3WcdxNEwSKvaAKgar90uQj NaqtaODQD7DaOtjlzhzm7k/LEuQgBkThjoJSXrUthUAWzfk5XqHn91uJLXK620t5mBGPc NojWESs6Rnq5HYGmsTYnUae9KMTTLSgxRwYkhXuHr82zwQFmT/yCUJEMHbGPY7cw/eRMj TEgoE1bm+V3GdbA58xgbDHad1boEqWuQIJ9+iksWBS8vDUEjxmcrhbbxW5PTsSHksvQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=J7E2Kv9T; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9C4F606A32C; Fri, 4 Dec 2026 11:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=J7E2Kv9T Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47FB31F0092C; Fri, 4 Dec 2026 11:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385590; bh=heRiY6l06TpYjX5T79LPrSIJtBB1vsQu8KUpTvLksr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=J7E2Kv9T7tGyBuaFWzOB5/NIYyoxLB1rFKR6S+Jxi5JVJdl4vR6rjZrjlYnNW24cj qUSun6hx9RxHWSayxQHDDGdP7pvjkNouywW7yUYCgwQAL1pvViwby0gOSZ6Ulw+z16 ImR4RQBjrGop9sgbu0IpN5Sq5wSc+Vdc4PY5Uq8g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chen Cheng , Mikulas Patocka Subject: [PATCH 6.6 0611/1167] dm snapshot: split discards on chunk boundaries Date: Fri, 4 Dec 2026 19:00:38 +0900 Message-ID: <20261204100717.983990980@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen Cheng commit 4fe2c2baad01da64d47f1a0c8fc093df994bcef5 upstream. dm-snapshot did not set ti->max_discard_granularity when it allows discards, so a discard could reach the target unaligned, or spanning several chunks. Set the flag, so dm splits discards on chunk boundaries. Fixes: 2e6023850e17 ("dm snapshot: add optional discard support features") Cc: stable@vger.kernel.org Signed-off-by: Chen Cheng Signed-off-by: Mikulas Patocka Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-snap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -1364,8 +1364,10 @@ static int snapshot_ctr(struct dm_target ti->private = s; ti->num_flush_bios = num_flush_bios; - if (s->discard_zeroes_cow) + if (s->discard_zeroes_cow) { ti->num_discard_bios = (s->discard_passdown_origin ? 2 : 1); + ti->max_discard_granularity = true; + } ti->per_io_data_size = sizeof(struct dm_snap_tracked_chunk); /* Add snapshot to the list of snapshots for this origin */