Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2041624

Summary: Verify udev information before taking irreversible overwriting action
Product: Red Hat Enterprise Linux 9 Reporter: Dennis Keefe <dkeefe>
Component: stratisdAssignee: Bryan Gurney <bgurney>
Status: CLOSED ERRATA QA Contact: Filip Suba <fsuba>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 9.1CC: amulhern, cwei, dkeefe, fsuba
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 9.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: stratisd-3.1.0-2.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:24: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:

Description Dennis Keefe 2022-01-17 21:58:33 UTC
from jakub Krysl - https://bugzilla.redhat.com/show_bug.cgi?id=1636535

Description of problem:
Creating Stratis pool on the same device as something that does not use or trigger properly udev causes Stratis to overwrite the device, as Stratis relies on udev. This could be prevented by checking /sys/block/$device/holders. Not sure if that is the best way though, there might be better.

Here is an example, as VDO does not trigger udev events properly atm - it sometimes misses the trigger.

# hexdump -C /dev/mapper/mpatha -n 4K
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001000

# vdo create --name vdo --device /dev/mapper/mpatha
Creating VDO vdo
Starting VDO vdo
Starting compression on VDO vdo
VDO instance 2 volume is ready at /dev/mapper/vdo

# hexdump -C /dev/mapper/mpatha -n 4K
00000000  64 6d 76 64 6f 30 30 31  05 00 00 00 04 00 00 00  |dmvdo001........|
00000010  00 00 00 00 5d 00 00 00  00 00 00 00 94 09 02 00  |....]...........|
00000020  7e 57 77 ce 79 77 05 00  41 de c1 37 ba 02 44 8a  |~Ww.yw..A..7..D.|
00000030  a3 b8 5d 7c a3 df 80 00  00 00 00 00 01 00 00 00  |..]|............|
00000040  00 00 00 00 01 00 00 00  d8 5c 0a 00 00 00 00 00  |.........\......|
00000050  00 ff ff ff 00 00 00 00  00 39 fa 4a 03 00 00 00  |.........9.J....|
00000060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001000

# lsblk
NAME     MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sdb        8:16   0     2T  0 disk
└─mpatha 253:0    0     2T  0 mpath
  └─vdo  253:1    0     2T  0 vdo

# stratis pool create test /dev/mapper/mpatha

# hexdump -C /dev/mapper/mpatha -n 4K
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  d6 83 3c a7 21 53 74 72  61 30 74 69 73 86 ff 02  |..<.!Stra0tis...|
00000210  5e 41 72 68 00 68 00 00  01 00 00 00 01 00 00 00  |^Arh.h..........|
00000220  37 66 34 30 64 30 39 36  65 34 32 66 34 63 38 34  |7f40d096e42f4c84|
00000230  39 33 33 38 32 35 62 38  31 38 63 63 31 66 62 65  |933825b818cc1fbe|
00000240  61 62 37 37 34 39 36 65  35 31 64 31 34 64 34 32  |ab77496e51d14d42|
00000250  62 38 36 65 39 61 37 36  61 62 31 34 31 30 63 33  |b86e9a76ab1410c3|
00000260  f0 07 00 00 00 00 00 00  00 18 00 00 00 00 00 00  |................|
00000270  00 00 00 00 00 00 00 00  e3 4e b7 5b 00 00 00 00  |.........N.[....|
00000280  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001000

# lsblk
NAME                                                                      MAJ:MIN RM   SIZE RO TYPE    MOUNTPOINT
sdb                                                                         8:16   0     2T  0 disk
└─mpatha                                                                  253:0    0     2T  0 mpath
  ├─vdo                                                                   253:1    0     2T  0 vdo
  └─stratis-1-private-7f40d096e42f4c84933825b818cc1fbe-physical-originsub 253:2    0   816M  0 stratis
    ├─stratis-1-private-7f40d096e42f4c84933825b818cc1fbe-flex-thinmeta    253:3    0    16M  0 stratis
    │ └─stratis-1-private-7f40d096e42f4c84933825b818cc1fbe-thinpool-pool  253:6    0   768M  0 stratis
    ├─stratis-1-private-7f40d096e42f4c84933825b818cc1fbe-flex-thindata    253:4    0   768M  0 stratis
    │ └─stratis-1-private-7f40d096e42f4c84933825b818cc1fbe-thinpool-pool  253:6    0   768M  0 stratis
    └─stratis-1-private-7f40d096e42f4c84933825b818cc1fbe-flex-mdv         253:5    0    16M  0 stratis

Version-Release number of selected component (if applicable):
stratisd-1.0.0-1.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
1. vdo create --name vdo --device /dev/mapper/mpatha
2. stratis pool create test /dev/mapper/mpatha

Actual results:
stratis pool is created

Expected results:
stratis pool is not created, device already in use

Additional info:

Comment 6 Filip Suba 2022-06-20 12:46:55 UTC
Verified with stratisd-3.1.0-2.el9.

Comment 8 errata-xmlrpc 2022-11-15 10:24: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 (stratisd 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/RHBA-2022:8124