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 2170318 - Block device with identical block sizes cannot be added to an encrypted pool after stopping and starting the pool again
Summary: Block device with identical block sizes cannot be added to an encrypted pool ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: stratisd
Version: 9.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Bryan Gurney
QA Contact: Filip Suba
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-02-16 06:54 UTC by Filip Suba
Modified: 2023-11-07 09:46 UTC (History)
5 users (show)

Fixed In Version: stratisd-3.5.5-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:32:31 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-148960 0 None None None 2023-02-16 18:29:39 UTC
Red Hat Product Errata RHBA-2023:6424 0 None None None 2023-11-07 08:32:35 UTC

Description Filip Suba 2023-02-16 06:54:12 UTC
Description of problem:
Stratis reports different logical block size after stopping and starting encrypted pool. This has been observed only with block device that has logical block size 512 bytes. In stratis report, logical block size(BLKSSSZGET) changed to 4096 from 512 after starting the pool. This seems to be related only to encrypted pools. Getting logical block size using blockdev --getss /dev/sdm still returns 512.

Version-Release number of selected component (if applicable):
stratisd-3.4.4-1.el9

How reproducible:
100%

Steps to Reproduce:
1. modprobe scsi_debug add_host=2 dev_size_mb=5000 sector_size=512 physblk_exp=3
2. stratis --propagate pool create --key-desc key test_pool /dev/sdm
3. stratis pool stop test_pool
4. stratis pool start --unlock-method keyring --name test_pool
5. stratis pool add-data test_pool /dev/sdn

Actual results:
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: ERROR: The sector sizes of the devices proposed for extending the data tier, BLKSSSZGET: 512 bytes, BLKPBSZGET: 4096 bytes, do not match the effective sector sizes of the existing data devices, BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes.


Expected results:
Block device is added to pool.


Additional info:
# stratis --propagate pool create --key-desc key test_pool /dev/sdm
# stratis report
{
    "name_to_pool_uuid_map": {},
    "path_to_ids_map": {},
    "pools": [
        {
            "available_actions": "fully_operational",
            "blockdevs": {
                "cachedevs": [],
                "datadevs": [
                    {
                        "blksizes": "BLKSSSZGET: 512 bytes, BLKPBSZGET: 4096 bytes",
                        "in_use": true,
                        "key_description": "key",
                        "path": "/dev/sdm",
                        "size": "10207232 sectors",
                        "uuid": "6dbe18d4-1cb3-428b-988a-de41b998d953"
                    }
                ]
            },
            "filesystems": [],
            "fs_limit": 100,
            "name": "test_pool",
            "uuid": "513e3be1-7dca-4c60-a2a6-9a912641fa66"
        }
    ],
    "stopped_pools": []
}
# stratis pool stop test_pool
# stratis pool start --unlock-method keyring --name test_pool
# stratis report
{
    "name_to_pool_uuid_map": {},
    "path_to_ids_map": {},
    "pools": [
        {
            "available_actions": "fully_operational",
            "blockdevs": {
                "cachedevs": [],
                "datadevs": [
                    {
                        "blksizes": "BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes",
                        "in_use": true,
                        "key_description": "key",
                        "path": "/dev/sdm",
                        "size": "10207232 sectors",
                        "uuid": "6dbe18d4-1cb3-428b-988a-de41b998d953"
                    }
                ]
            },
            "filesystems": [],
            "fs_limit": 100,
            "name": "test_pool",
            "uuid": "513e3be1-7dca-4c60-a2a6-9a912641fa66"
        }
    ],
    "stopped_pools": []
}
# stratis pool add-data test_pool /dev/sdn
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: ERROR: The sector sizes of the devices proposed for extending the data tier, BLKSSSZGET: 512 bytes, BLKPBSZGET: 4096 bytes, do not match the effective sector sizes of the existing data devices, BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes.

Comment 1 Bryan Gurney 2023-02-16 18:27:43 UTC
Be careful with scsi_debug when specifying multiple devices: unless you add the parameter "per_host_store=1", multiple devices will share the same memory space.  (This is probably not what you want; it will result in an effect similar to a SAN LUN that provides multiple paths from initiator to target: i.e.: both devices will have the same data content.)

Can you try again with the following scsi_debug modprobe statement?

$ sudo modprobe scsi_debug add_host=2 dev_size_mb=5000 sector_size=512 physblk_exp=3 per_host_store=1

Comment 2 Bryan Gurney 2023-02-16 18:33:32 UTC
I almost forgot one detail: make sure your system has enough RAM to be able to allocate memory for all of the host devices specified (in your case, 10 GiB).

Comment 3 Filip Suba 2023-02-16 20:39:13 UTC
I tried scsi_debug statement from your comment, and it is still reproducible.

# modprobe scsi_debug add_host=2 dev_size_mb=5000 sector_size=512 physblk_exp=3 per_host_store=1
# lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                           8:0    0   7.3T  0 disk 
sdb                           8:16   0   4.9G  0 disk 
sdc                           8:32   0   4.9G  0 disk 
nvme1n1                     259:0    0   1.7T  0 disk 
nvme0n1                     259:1    0 465.8G  0 disk 
├─nvme0n1p1                 259:2    0   600M  0 part /boot/efi
├─nvme0n1p2                 259:3    0     1G  0 part /boot
└─nvme0n1p3                 259:4    0 464.2G  0 part 
  ├─rhel_-root 253:0    0    70G  0 lvm  /
  ├─rhel_--76-swap 253:1    0   7.8G  0 lvm  [SWAP]
  └─rhel_--76-home 253:2    0 386.4G  0 lvm  /home
# cat /sys/bus/pseudo/drivers/scsi_debug/per_host_store 
1
# cat /sys/block/sdb/queue/logical_block_size 
512
# cat /sys/block/sdb/queue/physical_block_size
4096
# stratis pool create --key-desc key pool1 /dev/sdb
# stratis pool stop pool1
# stratis pool start --unlock-method keyring --name pool1
# stratis report
{
    "name_to_pool_uuid_map": {},
    "path_to_ids_map": {},
    "pools": [
        {
            "available_actions": "fully_operational",
            "blockdevs": {
                "cachedevs": [],
                "datadevs": [
                    {
                        "blksizes": "BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes",
                        "in_use": true,
                        "key_description": "key",
                        "path": "/dev/sdb",
                        "size": "10207232 sectors",
                        "uuid": "089810fc-e6e6-4f90-9c1b-2d13c09c85a9"
                    }
                ]
            },
            "filesystems": [],
            "fs_limit": 100,
            "name": "pool1",
            "uuid": "0b3bc5ff-c154-4472-ab5b-957d526aa189"
        }
    ],
    "stopped_pools": []
}
# stratis pool add-data pool1 /dev/sdc
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: ERROR: The sector sizes of the devices proposed for extending the data tier, BLKSSSZGET: 512 bytes, BLKPBSZGET: 4096 bytes, do not match the effective sector sizes of the existing data devices, BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes. 
# free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi        10Gi       3.9Gi        24Mi       1.0Gi       4.5Gi
Swap:          7.8Gi          0B       7.8Gi

Comment 4 Bryan Gurney 2023-02-16 21:00:07 UTC
OK, I've confirmed the same failure on my system.  For some reason, it seems to be that the data device in the pool changes from this:

            "blockdevs": {
                "cachedevs": [],
                "datadevs": [
                    {
                        "blksizes": "BLKSSSZGET: 512 bytes, BLKPBSZGET: 4096 bytes",
                        "in_use": true,
                        "key_description": "testkey1",
                        "path": "/dev/sdb",
                        "size": "10207232 sectors",
                        "uuid": "56a7be0b-03b9-47a5-9c41-aa5e02561554"
                    }
                ]
            },


...To this:


            "blockdevs": {
                "cachedevs": [],
                "datadevs": [
                    {
                        "blksizes": "BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes",
                        "in_use": true,
                        "key_description": "testkey1",
                        "path": "/dev/sdb",
                        "size": "10207232 sectors",
                        "uuid": "56a7be0b-03b9-47a5-9c41-aa5e02561554"
                    }
                ]
            },

...for the scsi_debug devices, which have these values from the "blockdev" command:

(physical block size:)
# blockdev --getpbsz /dev/sdb
4096

(logical sector size)
# blockdev --getss /dev/sdb
512

Comment 7 Filip Suba 2023-02-17 15:11:37 UTC
The same failure is also reproducible with real disks.

# cat /sys/block/sda/queue/logical_block_size 
512
# cat /sys/block/sda/queue/physical_block_size
4096
# stratis pool create --key-desc key pool1 /dev/sda
# stratis report
{
    "name_to_pool_uuid_map": {},
    "path_to_ids_map": {},
    "pools": [
        {
            "available_actions": "fully_operational",
            "blockdevs": {
                "cachedevs": [],
                "datadevs": [
                    {
                        "blksizes": "BLKSSSZGET: 512 bytes, BLKPBSZGET: 4096 bytes",
                        "in_use": true,
                        "key_description": "key",
                        "path": "/dev/sda",
                        "size": "4688398000 sectors",
                        "uuid": "4f384f2c-f199-454f-8e5e-2646ebc76033"
                    }
                ]
            },
            "filesystems": [],
            "fs_limit": 100,
            "name": "pool1",
            "uuid": "bd76ab71-8f5a-4e15-a9b4-26d2ce7a1a9d"
        }
    ],
    "stopped_pools": []
}
# stratis pool stop pool1
# stratis pool start --unlock-method keyring --name pool1
# stratis report
{
    "name_to_pool_uuid_map": {},
    "path_to_ids_map": {},
    "pools": [
        {
            "available_actions": "fully_operational",
            "blockdevs": {
                "cachedevs": [],
                "datadevs": [
                    {
                        "blksizes": "BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes",
                        "in_use": true,
                        "key_description": "key",
                        "path": "/dev/sda",
                        "size": "4688398000 sectors",
                        "uuid": "4f384f2c-f199-454f-8e5e-2646ebc76033"
                    }
                ]
            },
            "filesystems": [],
            "fs_limit": 100,
            "name": "pool1",
            "uuid": "bd76ab71-8f5a-4e15-a9b4-26d2ce7a1a9d"
        }
    ],
    "stopped_pools": []
}
# stratis pool add-data pool1 /dev/sdb
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: ERROR: The sector sizes of the devices proposed for extending the data tier, BLKSSSZGET: 512 bytes, BLKPBSZGET: 4096 bytes, do not match the effective sector sizes of the existing data devices, BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes.

Comment 8 Ondrej Kozina 2023-02-17 15:12:25 UTC
Do you encrypt the device with dm-crypt? The thing is luksFormat operation selects optimal encryption sector size since it can improve performance. If device size is properly aligned and also reports physical block size = 4K it will increase encryption sector size to 4K and effectively increase also logical block size.

Comment 9 Bryan Gurney 2023-02-17 15:53:50 UTC
(In reply to Ondrej Kozina from comment #8)
> Do you encrypt the device with dm-crypt? The thing is luksFormat operation
> selects optimal encryption sector size since it can improve performance. If
> device size is properly aligned and also reports physical block size = 4K it
> will increase encryption sector size to 4K and effectively increase also
> logical block size.

Yes, an encrypted Stratis pool is done via dm-crypt.

The physical block size of a "512e" or "Advanced Format" disk is 4096 bytes, while the logical block size (the result of "blockdev --getss") is 512 bytes.  The drive's controller performs 512-byte emulation, but uses 4096-byte physical blocks.

Comment 10 Bryan Gurney 2023-02-17 16:08:24 UTC
Here's an example with only scsi_debug and cryptsetup:

# modprobe scsi_debug add_host=2 dev_size_mb=5000 sector_size=512 physblk_exp=3 per_host_store=1

# cryptsetup luksFormat /dev/sdb
...
# cryptsetup luksOpen /dev/sdb crypttest1
...

# lsblk -i /dev/sdb
NAME         MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
sdb            8:16   0  4.9G  0 disk
`-crypttest1 253:0    0  4.9G  0 crypt

# blockdev --getss /dev/sdb
512
# blockdev --getpbsz /dev/sdb
4096
# blockdev --getss /dev/mapper/crypttest1
4096
# blockdev --getpbsz /dev/mapper/crypttest1
4096

Comment 11 Ondrej Kozina 2023-02-22 12:31:34 UTC
Yup, so to clarify what happens. By setting encryption sector size to 4K, active device dm-crypt device increases logical block size to 4K as well, even though underlying block device exposes 512e compatibility. The issue is dm-crypt (with 4K encryption sector size enabled) can not perform IO not aligned to 4K.

You may enforce encryption sector size during luksFormat operation. On API level you have to explicitly set 'sector_size' member in 'crypt_params_luks2' structure passed in 'crypt_format'.

Comment 12 mulhern 2023-04-07 01:39:16 UTC
We expect this to be fixed in the next stratisd release, 3.5.3. See GitHub issue: https://github.com/stratis-storage/stratisd/issues/3290 .

Comment 16 Filip Suba 2023-06-12 12:11:28 UTC
Verified with stratisd-3.5.5-1.el9.

# modprobe scsi_debug add_host=2 dev_size_mb=5000 sector_size=512 physblk_exp=3 per_host_store=1
# stratis --propagate pool create --key-desc key test_pool /dev/sdm
# stratis pool stop test_pool
# stratis pool start --unlock-method keyring --name test_pool
# stratis pool add-data test_pool /dev/sdn
# stratis report
{
    "name_to_pool_uuid_map": {},
    "partially_constructed_pools": [],
    "path_to_ids_map": {},
    "pools": [
        {
            "available_actions": "fully_operational",
            "blockdevs": {
                "cachedevs": [],
                "datadevs": [
                    {
                        "blksizes": "base: BLKSSSZGET: 512 bytes, BLKPBSZGET: 4096 bytes, crypt: BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes",
                        "in_use": true,
                        "key_description": "key",
                        "path": "/dev/sdm",
                        "size": "10207232 sectors",
                        "uuid": "35e99c01-7ffe-437f-bc79-539c27862820"
                    },
                    {
                        "blksizes": "base: BLKSSSZGET: 512 bytes, BLKPBSZGET: 4096 bytes, crypt: BLKSSSZGET: 4096 bytes, BLKPBSZGET: 4096 bytes",
                        "in_use": true,
                        "key_description": "key",
                        "path": "/dev/sdn",
                        "size": "10207232 sectors",
                        "uuid": "b8535c9a-ad84-459e-ba83-aa0c1467b310"
                    }
                ]
            },
            "filesystems": [],
            "fs_limit": 100,
            "name": "test_pool",
            "uuid": "b7c7bb55-2ad1-4565-9b79-cce3b0f99519"
        }
    ],
    "stopped_pools": []
}

Comment 18 errata-xmlrpc 2023-11-07 08:32:31 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-2023:6424


Note You need to log in before you can comment on or make changes to this bug.