Bug 1796659 - [RFE] Simplify PV creation on zoned block devices
Summary: [RFE] Simplify PV creation on zoned block devices
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: lvm2
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: LVM Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-30 21:20 UTC by Bryan Gurney
Modified: 2023-08-02 02:20 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Bryan Gurney 2020-01-30 21:20:26 UTC
Description of problem:

Host-managed zoned block devices (for example: Shingled Magnetic Recording hard drives) have restrictions on writes to "sequential write only" zones, which may cause problems when trying to create LVM logical volumes on volume groups based on zoned block devices.

Version-Release number of selected component (if applicable):
Fedora release 30 (Thirty)
kernel-5.4.10-100.fc30.x86_64
device-mapper-1.02.154-3.fc30.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Obtain a zoned block device.  Check the sysfs block device queue files to confirm that the zoned type is "host-managed", and to query for the zone size (in "chunk_sectors"):

$ grep -H . /sys/block/sde/queue/zoned
/sys/block/sde/queue/zoned:host-managed
$ grep -H . /sys/block/sde/queue/chunk_sectors                             
/sys/block/sde/queue/chunk_sectors:524288

2. Execute pvcreate on the device, followed by "vgcreate zonedtest" on the device.
3. Execute "lvcreate" on the device, to create a logical volume that is a portion of the total space available in the PV / VG.  In my example with a 12.73 TB device, I used the command "lvcreate -L5T -n zonedlv1 zonedtest"

Actual results:
$ sudo pvcreate /dev/sde
  Physical volume "/dev/sde" successfully created.
$ sudo vgcreate zonedtest /dev/sde
  Volume group "zonedtest" successfully created
$ sudo lvcreate -L5T -n zonedlv1 zonedtest
  device-mapper: reload ioctl on  (253:2) failed: Invalid argument
  Failed to activate new LV.

(messages from kernel:)

kernel: device-mapper: table: 253:2: start=2048 not aligned to h/w zone size 524288 of sde
kernel: device-mapper: core: Cannot calculate initial queue limits
kernel: device-mapper: ioctl: unable to set up device queue for new table.

(note that device-mapper properly checks for data alignment, in "device_area_is_invalid()"; if this check didn't exist, the drive could potentially return "Illegal Request - Unaligned write command" errors.  This may have been seen in older kernel versions.)


Expected results:
The "lvcreate" command executes without any problems, with the logical volume's device aligned at a zone boundary:

zonedtest-zonedlv1: 0 10737418240 linear 8:64 524288

This drive has 256 MB zones, so the offset of 524288 is at the start of a zone boundary.


Additional info:
It is possible to create a logical volume on a zoned block device by creating the physical volume using the "--dataalignment" option, to properly align the start of the data to a multiple of the zone size:

$ grep -H . /sys/block/sde/queue/zoned
/sys/block/sde/queue/zoned:host-managed
$ grep -H . /sys/block/sde/queue/chunk_sectors                             
/sys/block/sde/queue/chunk_sectors:524288
$ sudo pvcreate --dataalignment 524288s /dev/sde
  Physical volume "/dev/sde" successfully created.
$ sudo vgcreate zonedtest /dev/sde
  Volume group "zonedtest" successfully created
$ sudo lvcreate -L5T -n zonedlv1 zonedtest
  Logical volume "zonedlv1" created.

It would be nice to have this check performed automatically, for zoned block devices.

Comment 1 Ben Cotton 2020-04-30 20:29:39 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.


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