Bug 976045 - extension of external thin origin volume attempts to access beyond the disk
extension of external thin origin volume attempts to access beyond the disk
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2 (Show other bugs)
7.0
x86_64 Linux
high Severity high
: rc
: ---
Assigned To: Zdenek Kabelac
Cluster QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-19 15:48 EDT by Corey Marthaler
Modified: 2014-06-17 21:18 EDT (History)
8 users (show)

See Also:
Fixed In Version: lvm2-2.02.105-3.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 08:02:06 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Corey Marthaler 2013-06-19 15:48:45 EDT
Description of problem:
Are external origin volumes even supposed to be modified?

# FROM LVCONVERT MAN PAGE:
--originname NewExternalOriginVolumeName
  The new name for original logical volume, which becomes external origin volume.
  Without  this  option a default names of "lvol#" will be generated where # is the LVM internal number of the logical volume.  This volume will be read-only and cannot be further modified as long, as it is being used as external origin.


[root@qalvm-01 ~]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
[...]
/dev/mapper/snapper_thinp-origin 1014M   33M  982M   4% /mnt/origin


[root@qalvm-01 ~]# mount
[...]
/dev/mapper/snapper_thinp-origin on /mnt/origin type xfs (rw,relatime,attr2,inode64,noquota)


[root@qalvm-01 ~]# lvs -a -o +devices
  LV            VG            Attr      LSize  Pool Origin    Data%  Devices
  POOL          snapper_thinp twi-a-tz-  1.00g                  1.06 POOL_tdata(0)
  [POOL_tdata]  snapper_thinp Twi-ao---  1.00g                       /dev/vdh1(0)
  [POOL_tmeta]  snapper_thinp ewi-ao---  4.00m                       /dev/vdd1(0)
  extorigin     snapper_thinp ori------  1.00g                       /dev/vdg1(0)
  online_resize snapper_thinp Vwi-a-tz-  1.00g POOL origin      1.04
  origin        snapper_thinp Vwi-aotz-  1.00g POOL extorigin   1.04
  other1        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other2        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other3        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other4        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other5        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00


[root@qalvm-01 ~]# lvextend -L +500M -r /dev/snapper_thinp/origin
  Extending logical volume origin to 1.49 GiB
  Logical volume origin successfully resized
meta-data=/dev/mapper/snapper_thinp-origin isize=256    agcount=8, agsize=32768 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=262144, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
xfs_growfs: XFS_IOC_FSGROWFSDATA xfsctl failed: Input/output error
fsadm: Resize xfs failed
  fsadm failed: 1


[root@qalvm-01 ~]# lvs -a -o +devices
  /dev/snapper_thinp/origin: read failed after 0 of 512 at 1597964288: Input/output error
  /dev/snapper_thinp/origin: read failed after 0 of 512 at 1598021632: Input/output error
  LV            VG            Attr      LSize  Pool Origin    Data%  Devices
  POOL          snapper_thinp twi-a-tz-  1.00g                  1.06 POOL_tdata(0)
  [POOL_tdata]  snapper_thinp Twi-ao---  1.00g                       /dev/vdh1(0)
  [POOL_tmeta]  snapper_thinp ewi-ao---  4.00m                       /dev/vdd1(0)
  extorigin     snapper_thinp ori------  1.00g                       /dev/vdg1(0)
  online_resize snapper_thinp Vwi-a-tz-  1.00g POOL origin      1.04
  origin        snapper_thinp Vwi-aotz-  1.49g POOL extorigin   0.70   <-- ### EXTENDED TO 1.5G ###
  other1        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other2        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other3        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other4        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other5        snapper_thinp Vwi-a-tz-  1.00g POOL             0.00


Jun 19 13:21:49 qalvm-01 kernel: [171929.896439] dm-7: rw=0, want=3121149, limit=2097152
Jun 19 13:21:49 qalvm-01 kernel: [171929.897239] attempt to access beyond end of device
Jun 19 13:21:49 qalvm-01 kernel: [171929.897903] dm-7: rw=0, want=3121150, limit=2097152
Jun 19 13:21:49 qalvm-01 kernel: [171929.898733] attempt to access beyond end of device
Jun 19 13:21:49 qalvm-01 kernel: [171929.899500] dm-7: rw=0, want=3121151, limit=2097152
Jun 19 13:21:49 qalvm-01 kernel: [171929.900226] attempt to access beyond end of device



Version-Release number of selected component (if applicable):
3.8.0-0.40.el7.x86_64
lvm2-2.02.99-0.57.el7    BUILT: Mon Jun 17 08:28:21 CDT 2013
lvm2-libs-2.02.99-0.57.el7    BUILT: Mon Jun 17 08:28:21 CDT 2013
lvm2-cluster-2.02.99-0.57.el7    BUILT: Mon Jun 17 08:28:21 CDT 2013
device-mapper-1.02.78-0.57.el7    BUILT: Mon Jun 17 08:28:21 CDT 2013
device-mapper-libs-1.02.78-0.57.el7    BUILT: Mon Jun 17 08:28:21 CDT 2013
device-mapper-event-1.02.78-0.57.el7    BUILT: Mon Jun 17 08:28:21 CDT 2013
device-mapper-event-libs-1.02.78-0.57.el7    BUILT: Mon Jun 17 08:28:21 CDT 2013
cmirror-2.02.99-0.57.el7    BUILT: Mon Jun 17 08:28:21 CDT 2013


How reproducible:
Everytime
Comment 1 Corey Marthaler 2013-06-19 15:51:24 EDT
Here's just a simple volume resize, should lvm be allowing this attempt?

[root@qalvm-01 ~]# lvresize -L +500 snapper_thinp/origin
  Extending logical volume origin to 1.49 GiB
  Logical volume origin successfully resized

[root@qalvm-01 ~]# lvs -a -o +devices
  /dev/snapper_thinp/origin: read failed after 0 of 4096 at 1597964288: Input/output error
  /dev/snapper_thinp/origin: read failed after 0 of 4096 at 1598021632: Input/output error
  LV           VG            Attr      LSize  Pool Origin    Data%  Devices
  POOL         snapper_thinp twi-a-tz-  1.00g                  0.00 POOL_tdata(0)
  [POOL_tdata] snapper_thinp Twi-ao---  1.00g                       /dev/vdh1(0)
  [POOL_tmeta] snapper_thinp ewi-ao---  4.00m                       /dev/vdd1(0)
  extorigin    snapper_thinp ori------  1.00g                       /dev/vdg1(0)
  origin       snapper_thinp Vwi-a-tz-  1.49g POOL extorigin   0.00
  other1       snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other2       snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other3       snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other4       snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
  other5       snapper_thinp Vwi-a-tz-  1.00g POOL             0.00
Comment 2 Zdenek Kabelac 2013-08-02 09:12:23 EDT
lvm2 tool needs to disable this for now - and kernel target needs to provide improved target to allow this operation. When the new version will be ready,
this feature which would support extension of thin volume using thin external origin volume could be enabled.
Comment 3 Alasdair Kergon 2013-08-02 19:19:17 EDT
The kernel target does not look at the size of the external origin at the moment.

I think we should keep this bug for fixing lvm2 not to allow this operation with the current version of the kernel target.

Then split off a kernel bugzilla.
E.g. record the external origin size on table load

tc->origin_dev_size = i_size_read(origin_dev->bdev->bd_inode) >> SECTOR_SHIFT;

and check the end of the bio data against this in process_bio() when deciding whether to remap or provision.

I think it's OK to require that the external origin is not reduced in size and this case does not need handling in the kernel.

We may also need to check what happens at the end of the device if the external origin is not an exact multiple of the pool block size.
Comment 4 Alasdair Kergon 2013-11-14 09:30:18 EST
Use bug 1030411 for the kernel fix.  It might be the snapshot or the origin that is resized.
Comment 5 Corey Marthaler 2014-01-24 17:40:49 EST
This still exists in the latest rpms.

[root@host-050 ~]# lvextend -L +500M -r /dev/snapper_thinp/origin
  Extending logical volume origin to 1.49 GiB
  Logical volume origin successfully resized
meta-data=/dev/mapper/snapper_thinp-origin isize=256    agcount=8, agsize=32768 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=262144, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
xfs_growfs: XFS_IOC_FSGROWFSDATA xfsctl failed: Input/output error
fsadm: Resize xfs failed
  fsadm failed: 1

[92925.770555] attempt to access beyond end of device
[92925.770978] dm-7: rw=32, want=3121152, limit=2097152


lvm2-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
lvm2-libs-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
lvm2-cluster-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-libs-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-event-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-event-libs-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-persistent-data-0.2.8-3.el7    BUILT: Fri Dec 27 13:40:56 CST 2013
cmirror-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
Comment 6 Zdenek Kabelac 2014-01-28 05:47:46 EST
Enhanced support introduced in couple upstream commits.

https://www.redhat.com/archives/lvm-devel/2014-January/msg00048.html
https://www.redhat.com/archives/lvm-devel/2014-January/msg00050.html
https://www.redhat.com/archives/lvm-devel/2014-January/msg00063.html

lvm2 with todays thin pool kernel targets (1.10) will support reduction of thin volume with external origin, but it will not allow extension with 2 different errors. Extension of lv with the same size as external origin will fail on unsupported kernel target feature. But if the LV has been already reduced, it will error on unsupported re-extension - since this would require a new type of nontrivial mapping to be created in dm-table.
Comment 8 Corey Marthaler 2014-02-06 17:56:10 EST
The extension of external thin origins are no longer allowed in the latest rpms, however the error given is "Thin target does not support external origin smaller then thin volume." Shouldn't the error just say it's not allowed like when attempting to extend the actual origin volume? I think that may be more clear. Marking this bug verified and will open a low prior bug on the error message.

[root@host-003 ~]# lvs -a -o +devices
  LV              Attr       LSize   Pool Origin     Data%  Devices       
  POOL            twi-a-tz--   1.00g                 1.70   POOL_tdata(0) 
  [POOL_tdata]    Twi-ao----   1.00g                        /dev/sdg1(1)  
  [POOL_tmeta]    ewi-ao----   4.00m                        /dev/sdf1(0)  
  extorigin       ori------- 852.00m                        /dev/sdg1(257)
  [lvol0_pmspare] ewi-------   4.00m                        /dev/sdg1(0)  
  online_resize   Vwi-a-tz-k 852.00m POOL origin     2.03                 
  origin          Vwi-aotz-- 852.00m POOL extorigin  2.03                 
  other1          Vwi-a-tz-- 600.00m POOL            0.00                 
  other2          Vwi-a-tz-- 600.00m POOL            0.00                 
  other3          Vwi-a-tz-- 600.00m POOL            0.00                 
  other4          Vwi-a-tz-- 600.00m POOL            0.00                 
  other5          Vwi-a-tz-- 600.00m POOL            0.00                 

# thin extension attempt
[root@host-003 ~]# lvextend -L +100M -r /dev/snapper_thinp/origin
  Thin target does not support external origin smaller then thin volume.
  Run `lvextend --help' for more information.

# ext origin attempt
[root@host-003 ~]# lvextend -L +100M -r /dev/snapper_thinp/extorigin
  Cannot resize external origin "extorigin".
  Run `lvextend --help' for more information.


3.10.0-80.el7.x86_64
lvm2-2.02.105-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
lvm2-libs-2.02.105-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
lvm2-cluster-2.02.105-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-1.02.84-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-libs-1.02.84-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-event-1.02.84-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-event-libs-1.02.84-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-persistent-data-0.2.8-3.el7    BUILT: Fri Dec 27 13:40:56 CST 2013
cmirror-2.02.105-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
Comment 9 Zdenek Kabelac 2014-02-07 06:48:31 EST
(In reply to Corey Marthaler from comment #8)
> The extension of external thin origins are no longer allowed in the latest
> rpms, however the error given is "Thin target does not support external
> origin smaller then thin volume." Shouldn't the error just say it's not
> allowed like when attempting to extend the actual origin volume? I think
> that may be more clear. Marking this bug verified and will open a low prior
> bug on the error message.

In the future we will support more freedom in the size of thinly provisioned volumes with external origin. It will be detected and enabled once the thin pool targets works properly in this case.
Comment 10 Ludek Smid 2014-06-13 08:02:06 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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