Bug 911343 - LV logical sector size changes when adding device with larger logical sector size
Summary: LV logical sector size changes when adding device with larger logical sector ...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: lvm2
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: LVM and device-mapper development team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-14 19:11 UTC by Eric Sandeen
Modified: 2015-02-17 14:46 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-17 14:46:10 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Eric Sandeen 2013-02-14 19:11:53 UTC
If a user has an LV comprised of 512 logical sector devices, and adds a 4k logical sector device to it, the LV itself will change from 512-logical to 4k-logical.

Changing a fundamental property of the block device like this has several implications the administrator may not be aware of; IMHO it should not happen silently, at least.

For example, DIO granularity requirements suddenly change, and an application may have been configured or tuned to the previous 512 granularity.

Another example is XFS, which expects to do sector-sized IO to various filesystem structures.  At mkfs time, XFS queries the block device for sector size and configures itself accordingly.   If a 512-logical LV is extended to include 4k devices, subsequent XFS mounts will fail with i.e.

Feb 14 16:41:52 kernel: [  481.055422] XFS (dm-5): device supports 4096 byte sectors (not 512) 

Rémi Cailletaud provides this additional information and testcase:

Following steps reproduce the "bug", considering we already have one pv on /dev/sdc (512 sectors device) :

- create a virtual 4k scsi device and create a pv on it :
# modprobe scsi_debug sector_size=4096 dev_size_mb=256
# pvcreate /dev/sdd

- create a vg with both pv, and create an lv on sdc (I specified exact extents count of sdc) :
# vgcreate vgtest  /dev/sdc /dev/sdd
# lvcreate -n lvtest -l 3759 vgtest

- mkfs, mount :
# mkfs.xfs /dev/vgtest/lvtest
# mount /dev/vgtest/lvtest /mnt/tmp

- the bad thing : lvextend and growfs (should not lvm or xfs check this sector size stuff ?):
# lvextend -l+40 /dev/vgtest/lvtest
# xfs_growfs /mnt/tmp
(fail with xfs_growfs: XFS_IOC_FSGROWFSDATA xfsctl failed)

- the scary part :
# umount /mnt/tmp
# mount /dev/vgtest/lvtest /mnt/tmp
mount: function not implemented
# tail -1 /var/log/messages
Feb 14 16:41:52 hamaika kernel: [  481.055422] XFS (dm-5): device supports 4096 byte sectors (not 512)

Comment 1 Alasdair Kergon 2013-02-14 20:20:21 UTC
The whole point of virtual devices is that their properties are dynamic and can change at any time and properties that could formerly be described by a fixed single value now vary according to the offset within the virtual device.

The sector size in your example is 512 at some offsets and 4k at other offsets.  The kernel only offers us a single value so we pick 4k for obvious reasons.

Until/unless there is a decent notification mechanism to upper layers when properties underneath any given layer change, it is the responsibility of the originator of the change to co-ordinate the change across all the layers that need to know.


Now the question is: what should we do about this?

(1) If XFS got notified of the sector size change (or it could detect it at the time of the 'grow'), could it handle it?

(2) If some component of the system "knows" that XFS is mounted over LVM and that XFS cannot handle an size change upwards, then to some degree, that "restriction" viz. "do not increase the sector size" could be enforced downwards.  In LVM terms it would be an additional restriction applied to the LV enforcing a given sector size within it.

Comment 2 Eric Sandeen 2013-02-14 21:48:33 UTC
(1) XFS can't handle it, no.  But I don't want to focus on XFS too much here...

Of course the properties can change, storage managed by lvm is wonderfully dynamic and flexible.  The administrator can choose to do all kinds of things.

What I don't want is surprising changes that break the application using the storage, when they weren't asked for.

If I tell lvm to change the sector size it reports, that's great, I'm glad it's so flexible.

If I tell lvm to add physical device B to existing lv A, I don't want IOs that used to work to now suddenly start to fail, without some kind of heads up or warning or confirmation.

That's all.

Comment 3 Eric Sandeen 2013-02-14 22:08:12 UTC
In my dream world, for now, I could imagine something like:

# lvextend
"This will tighten a constraint on the device you have right now."
<fail>

# lvchange --modify-that-constraint-intentionally

# lvextend
<success>

Comment 4 Fedora End Of Life 2013-04-03 16:01:45 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 5 Fedora End Of Life 2015-01-09 17:40:39 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

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 19 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.

Comment 6 Fedora End Of Life 2015-02-17 14:46:10 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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