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 733320 - lvresize: When resizing striped LV it should align the size up instead of down
Summary: lvresize: When resizing striped LV it should align the size up instead of down
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.2
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Petr Rockai
QA Contact: Corey Marthaler
URL:
Whiteboard:
Depends On:
Blocks: 743047
TreeView+ depends on / blocked
 
Reported: 2011-08-25 13:16 UTC by Lukáš Czerner
Modified: 2011-12-06 17:02 UTC (History)
10 users (show)

Fixed In Version: lvm2-2.02.87-3.el6
Doc Type: Bug Fix
Doc Text:
When striped logical volume was resized with the lvresize command, the size was aligned to the stripe boundary down. This could pose a problem when shrinking the volume with file system on it, because even if we computed the new size so that the file system did fit entirely onto the volume and resized it, the alignment done by the lvresize might have cut off a part of the file system and hence it might have corrupted it. To fix this, the rounding has been corrected for striped volumes so the volume never reduces more than requested.
Clone Of:
Environment:
Last Closed: 2011-12-06 17:02:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1522 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2011-12-06 00:50:10 UTC

Description Lukáš Czerner 2011-08-25 13:16:30 UTC
Description of problem:

When resizing striped logical volume with lvresize current implementation aligns the size to the stripe boundary down. However it represent a problem when shrinking the volume with file system on it, because even if we compute the new size so the file system will fit entirely onto the volume and resize it, the alignment done by the lvresize might cut off a part of the file system, hence corrupts it.

lvresize should round the size up, instead of down, to avoid such problems.



Version-Release number of selected component (if applicable):
  LVM version:     2.02.87(2)-RHEL6 (2011-08-12)
  Library version: 1.02.68-cvs (2011-08-19)
  Driver version:  4.21.6



How reproducible:

 # lvcreate -v --name lvol003 -L 2G -i 3 -I 32 vg001
 # lvresize -v -L1077936128b /dev/vg001/lvol003
...
  Rounding size (257 extents) down to stripe boundary size for segment (255 extents)

Note that this works if you use lvreduce instead, but those two commands should do exactly the same thing!

 #  lvreduce -v -L1077936128b /dev/vg001/lvol003
...
  Rounding size (257 extents) up to stripe boundary size for segment (258 extents)



Actual results:

  Rounding size (257 extents) down to stripe boundary size for segment (255 extents)

rounding the new size down.


Expected results:

  Rounding size (257 extents) up to stripe boundary size for segment (258 extents)

rounding the new size up.

Comment 2 Alasdair Kergon 2011-08-25 13:35:16 UTC
When reducing, the logic for lvresize should indeed be identical to lvreduce.
Rounding should always be done in the 'safe' direction.

There was a recent fix:
    Fix extent rounding for striped volumes never to reduce more than requested

- perhaps this case was missed?

Comment 3 Lukáš Czerner 2011-08-25 13:38:41 UTC
BTW, the problem is upstream as well.

Thanks!
-Lukas

Comment 4 Milan Broz 2011-08-25 14:10:57 UTC
yes, the case is missed. rounding logic is there but the condition which trigger it seems to be incomplete.

Comment 5 Peter Rajnoha 2011-09-21 15:41:28 UTC
This should work now:

[root@node-a ~]# lvcreate --name test -L 2G -i 3 -I 32 vg
  Rounding size (512 extents) up to stripe boundary size (513 extents)
  Logical volume "test" created

[root@node-a ~]# lvresize -L 1077936128b /dev/vg/test 
  Rounding size (257 extents) up to stripe boundary size for segment (258 extents)
  Reducing logical volume test to 1.01 GiB
  Logical volume test successfully resized

is now the same as lvreduce:

[root@node-a ~]# lvreduce -L 1077936128b /dev/vg/test 
  Rounding size (257 extents) up to stripe boundary size for segment (258 extents)
  Reducing logical volume test to 1.01 GiB
  Logical volume test successfully resized

Comment 6 Corey Marthaler 2011-09-21 15:43:46 UTC
Adding QA ack for this 6.2 blocker.

Devel test results in comment #5.

Comment 8 Corey Marthaler 2011-09-28 22:34:22 UTC
Fix verified in the latest rpms.

2.6.32-201.el6.x86_64

lvm2-2.02.87-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
lvm2-libs-2.02.87-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
lvm2-cluster-2.02.87-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
udev-147-2.40.el6    BUILT: Fri Sep 23 07:51:13 CDT 2011
device-mapper-1.02.66-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
device-mapper-libs-1.02.66-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
device-mapper-event-1.02.66-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
device-mapper-event-libs-1.02.66-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
cmirror-2.02.87-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011



[root@hayes-01 ~]# lvcreate -v -n stripe -L 2G -i 3 -I 32 hayes
    Setting logging type to disk
    Finding volume group "hayes"
  Rounding size (512 extents) up to stripe boundary size (513 extents)
  [...]
  Logical volume "stripe" created
[root@hayes-01 ~]# lvs -a -o +devices
  LV      VG         Attr   LSize  Origin Snap%  Move Log Copy%  Convert Devices                                                          
  stripe  hayes      -wi-a-  2.00g                                       /dev/etherd/e1.1p1(0),/dev/etherd/e1.1p2(0),/dev/etherd/e1.1p3(0)

[root@hayes-01 ~]# lvresize -v -L1077936128b /dev/hayes/stripe 
    Finding volume group hayes
  Rounding size (257 extents) up to stripe boundary size for segment (258 extents)
  [...]
  Logical volume stripe successfully resized

[root@hayes-01 ~]# lvreduce -L 1077936128b /dev/hayes/stripe 
  Rounding size (257 extents) up to stripe boundary size for segment (258 extents)
  [...]
Do you really want to reduce stripe? [y/n]: y
  Reducing logical volume stripe to 1.01 GiB
  Logical volume stripe successfully resized

Comment 9 Peter Rajnoha 2011-10-27 08:13:32 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When striped logical volume was resized with the lvresize command, the size was aligned to the stripe boundary down. This could pose a problem when shrinking the volume with file system on it, because even if we computed the new size so that the file system did fit entirely onto the volume and resized it, the alignment done by the lvresize might have cut off a part of the file system and hence it might have corrupted it. To fix this, the rounding has been corrected for striped volumes so the volume never reduces more than requested.

Comment 10 errata-xmlrpc 2011-12-06 17:02:42 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, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1522.html


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