Bug 2183556

Summary: dm: discard IOs on striped or snap LVs can trigger data corruption [RHEL-9.3]
Product: Red Hat Enterprise Linux 9 Reporter: Ben Marzinski <bmarzins>
Component: kernelAssignee: Ben Marzinski <bmarzins>
kernel sub component: Device Mapper QA Contact: Filip Suba <fsuba>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: agk, fsuba, msnitzer, nweddle, vdo-internal
Version: 9.1Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kernel-5.14.0-304.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2183559 2184420 2184429 (view as bug list) Environment:
Last Closed: 2023-11-07 08:43:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2183559, 2184420, 2184429    
Attachments:
Description Flags
reproducer script none

Description Ben Marzinski 2023-03-31 15:29:38 UTC
Description of problem:
DM is improperly processing of duplicate abnormal bios, such as discards, write zeros and secure erase. This can cause dm-stripe and dm-snap to send IO to the wrong disk or wrong part of a disk, potentially causing data corruption

Version-Release number of selected component (if applicable):
kernel-5.14.0-124.el9

How reproducible:
Always

Steps to Reproduce:
1. # vgcreate vg <dev1> <dev2> <dev3> <dev4>
2. # lvcreate -l 100%VG  --stripes 2 vg -n lv
3. # blkdiscard /dev/vg/lv

Actual results:
blkdiscard: /dev/vg/lv: BLKDISCARD ioctl failed: Input/output error

[  875.631996] blkdiscard: attempt to access beyond end of device
[  875.631996] loop0: rw=2051, sector=2048, nr_sectors = 147456 limit=81920
[  875.632009] blkdiscard: attempt to access beyond end of device
[  875.632009] loop1: rw=2051, sector=2048, nr_sectors = 147456 limit=81920

Expected results:
No error

Additional info:

Comment 1 Ben Marzinski 2023-03-31 17:27:27 UTC
The fix for this issue is in the following linux-dm commits:

f7b58a69fad9 dm: fix improper splitting for abnormal bios
666eed46769d dm: fix __send_duplicate_bios() to always allow for splitting IO

The upstream kernel bug for this issue is here:
https://bugzilla.kernel.org/show_bug.cgi?id=217273

Comment 2 Ben Marzinski 2023-03-31 17:52:19 UTC
Created attachment 1954924 [details]
reproducer script

Comment 6 Ben Marzinski 2023-04-04 15:59:57 UTC
Moving zstream request to rhel-8.2 version of this bug, bz 2184420.

Comment 11 Filip Suba 2023-05-01 13:06:17 UTC
Verified with kernel-5.14.0-304.el9.

Comment 13 errata-xmlrpc 2023-11-07 08:43:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: kernel security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6583