Bug 2183559

Summary: dm: discard IOs on striped or snap LVs can trigger data corruption [RHEL-8.9]
Product: Red Hat Enterprise Linux 8 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, jpittman, msnitzer, nweddle, storage-qe, vdo-internal
Version: 8.9Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kernel-4.18.0-489.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2183556 Environment:
Last Closed: 2023-11-14 15:41:55 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: 2183556    
Bug Blocks:    

Description Ben Marzinski 2023-03-31 16:05:28 UTC
+++ This bug was initially created as a clone of Bug #2183556 +++

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:26:58 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 10 Filip Suba 2023-05-01 13:07:36 UTC
Verified with kernel-4.18.0-489.el8.

Comment 12 errata-xmlrpc 2023-11-14 15:41:55 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:7077