Skip to contentSkip to conversation

lvresize fails with "reload ioctl failed: Invalid argument"

DISCUSSION Laurent Riffard 4 participants 10 messages Sep 10, 2006 – Sep 12, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

I'm unable to resize any LV, it fails with such a message:

[root@calimero ~]# lvresize --extents +1 /dev/vglinux1/lvswap2
Extending logical volume lvswap2 to 1.00 GB
device-mapper: reload ioctl failed: Invalid argument Failed to suspend lvswap2

[root@calimero ~]# lvm2 version
LVM version: 2.02.06 (2006-05-12)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
[root@calimero ~]# cat /proc/version Linux version 2.6.18-rc6-mm1 ([email protected]) (gcc version 4.1.1 20060724 (prerelease) (4.1.1-3mdk)) #145 Sun Sep 10 20:48:49 CEST 2006

Is it a known problem ?

I can't tell precisely when it started to fails. This failure appeared when I udpated my distro from Mandriva 2006.0 to 2007.0 beta. So I guess I was working with lvm 2.01.09 and libdevmapper 1.01.00.

Here is some additional info on my environment:
[root@calimero ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vglinux1 2 13 0 wz--n- 36.41G 13.10G
[root@calimero ~]# pvs

 PV         VG       Fmt  Attr PSize  PFree
 /dev/sda4  vglinux1 lvm2 a-   19.07G 3.56G
 /dev/sdb7  vglinux1 lvm2 a-   17.34G 9.54G
[root@calimero ~]# lvs
 LV          VG       Attr   LSize   Origin Snap%  Move Log Copy% 
 lvccache    vglinux1 -wc-ao   2.00G                              
 lvfreenet   vglinux1 -wi-ao   3.27G                              
 lvhome      vglinux1 -wn-ao   7.00G                              
 lvkernel    vglinux1 -wi-ao   2.00G                              
 lvkernel-r4 vglinux1 -wi-a-   2.00G                              
 lvroot      vglinux1 -wi-ao 256.00M                              
 lvroot-old  vglinux1 -wi-a- 256.00M                              
 lvswap      vglinux1 -wi-ao   1.00G                              
 lvswap2     vglinux1 -wi-ao   1.00G                              
 lvtmp       vglinux1 -wi-ao  64.00M                              
 lvusr       vglinux1 -wi-ao   3.50G                              
 lvvar       vglinux1 -wi-ao 504.00M                              
 lvvar-old   vglinux1 -wn-a- 500.00M                              
[root@calimero ~]# lvdisplay -m /dev/vglinux1/lvswap2
 --- Logical volume ---
 LV Name                /dev/vglinux1/lvswap2
 VG Name                vglinux1
 LV UUID                d0jM40-7psI-O7uP-ocsn-cuIL-AJN0-eYxtMo
 LV Write Access        read/write
 LV Status              available
 # open                 1
 LV Size                1.00 GB
 Current LE             256
 Segments               1
 Allocation             inherit
 Read ahead sectors     0
 Block device           254:9

--- Segments ---
Logical extent 0 to 255:

   Type                linear
   Physical volume     /dev/sdb7
   Physical extents    1681 to 1936

[root@calimero ~]# lvresize -vvv --extents +1 /dev/vglinux1/lvswap2
.....
Loading vglinux1-lvswap2 table

       Adding target: 0 2097152 linear 8:23 13771136
       Adding target: 2097152 8192 linear 8:23 23683456
       dm table   (254:9) O   [16384]
       dm reload   (254:9) N   [16384]

device-mapper: reload ioctl failed: Invalid argument
Failed to suspend lvswap2
Wiping pre-committed vglinux1 metadata from /dev/sda4 header at 2048 Wiping pre-committed vglinux1 metadata from /dev/sdb7 header at 2048
Unlocking /var/lock/lvm/V_vglinux1
Closed /dev/sda4
Closed /dev/sdb7
[root@calimero ~]#

Thanks for your help
~~
laurent

#1 lore raw
Quoted 10 lines · Laurent Riffard

device-mapper: reload ioctl failed: Invalid argument

LVM version: 2.02.06 (2006-05-12)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
Linux version 2.6.18-rc6-mm1 ([email protected]) (gcc version 4.1.1 20060724 (prerelease) (4.1.1-3mdk)) #145 Sun Sep 10 20:48:49 CEST 2006

Is it a known problem ?

Not sure, but try updating lvm2 version to the same date as the library version (at least 2.02.08 15th August).

Alasdair

Signature · 1 line
[email protected]
#2 lore raw
Quoted 9 lines · Alasdair G Kergon
Quoted 6 lines · Laurent Riffard

device-mapper: reload ioctl failed: Invalid argument

LVM version: 2.02.06 (2006-05-12)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
Linux version 2.6.18-rc6-mm1 ([email protected]) (gcc version 4.1.1 20060724 (prerelease) (4.1.1-3mdk)) #145 Sun Sep 10 20:48:49 CEST 2006

Quoted 5 lines
Quoted 1 line

Is it a known problem ?

Not sure, but try updating lvm2 version to the same date as the library version (at least 2.02.08 15th August).

Laurent, can you please try the packages from:
http://kenobi.mandriva.com/~bluca/

10x
L.

Signature · 6 lines
Luca Berra -- [email protected]
       Communication Media & Services S.r.l.
/"\
\ /     ASCII RIBBON CAMPAIGN
 X        AGAINST HTML MAIL
/ \
#3 lore raw
Quoted 10 lines · Luca Berra
Quoted 9 lines · Alasdair G Kergon
Quoted 6 lines · Laurent Riffard

device-mapper: reload ioctl failed: Invalid argument

LVM version: 2.02.06 (2006-05-12)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
Linux version 2.6.18-rc6-mm1 ([email protected]) (gcc version 4.1.1 20060724 (prerelease) (4.1.1-3mdk)) #145 Sun Sep 10 20:48:49 CEST 2006

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Is it a known problem ?

Not sure, but try updating lvm2 version to the same date as the library version (at least 2.02.08 15th August).

Laurent, can you please try the packages from:
http://kenobi.mandriva.com/~bluca/

No luck!

[root@calimero ~]# rpm -q lvm2 libdevmapper1.02 lvm2-2.02.09-1mdv2007.0 libdevmapper1.02-1.02.09-1mdv2007.0
[root@calimero ~]# lvm2 version
LVM version: 2.02.09 (2006-08-17)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
[root@calimero ~]# lvresize --extents +1 /dev/vglinux1/lvswap2
Extending logical volume lvswap2 to 1,00 GB
device-mapper: reload ioctl failed: Argument invalide Failed to suspend lvswap2

Will try vanilla to compile and test vanilla lvm2 2.02.08 as Alasdair suggested.

~~
laurent

#4 lore raw
Quoted 33 lines · Laurent Riffard
Quoted 10 lines · Luca Berra
Quoted 9 lines · Alasdair G Kergon
Quoted 6 lines · Laurent Riffard

device-mapper: reload ioctl failed: Invalid argument

LVM version: 2.02.06 (2006-05-12)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
Linux version 2.6.18-rc6-mm1 ([email protected]) (gcc version 4.1.1 20060724 (prerelease) (4.1.1-3mdk)) #145 Sun Sep 10 20:48:49 CEST 2006

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Is it a known problem ?

Not sure, but try updating lvm2 version to the same date as the library version (at least 2.02.08 15th August).

Laurent, can you please try the packages from:
http://kenobi.mandriva.com/~bluca/

No luck!

[root@calimero ~]# rpm -q lvm2 libdevmapper1.02 lvm2-2.02.09-1mdv2007.0 libdevmapper1.02-1.02.09-1mdv2007.0
[root@calimero ~]# lvm2 version
LVM version: 2.02.09 (2006-08-17)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
[root@calimero ~]# lvresize --extents +1 /dev/vglinux1/lvswap2
Extending logical volume lvswap2 to 1,00 GB
device-mapper: reload ioctl failed: Argument invalide Failed to suspend lvswap2

Quoted 1 line

Will try vanilla to compile and test vanilla lvm2 2.02.08 as Alasdair suggested.

works for me with 2.6.17-4mdv kernel
maybe something related to your kernel version?

L.

Signature · 6 lines
Luca Berra -- [email protected]
       Communication Media & Services S.r.l.
/"\
\ /     ASCII RIBBON CAMPAIGN
 X        AGAINST HTML MAIL
/ \
#9 lore raw
In reply to Alasdair G Kergon
Quoted 9 lines · Alasdair G Kergon
Quoted 6 lines · Laurent Riffard

device-mapper: reload ioctl failed: Invalid argument

LVM version: 2.02.06 (2006-05-12)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
Linux version 2.6.18-rc6-mm1 ([email protected]) (gcc version 4.1.1 20060724 (prerelease) (4.1.1-3mdk)) #145 Sun Sep 10 20:48:49 CEST 2006

Quoted 6 lines
Quoted 1 line

Is it a known problem ?

Not sure, but try updating lvm2 version to the same date as the library version (at least 2.02.08 15th August).

Alasdair

Still fails...

[root@calimero ~]# PATH=/home/laurent/bin:/home/laurent/sbin:$PATH [root@calimero ~]# lvm version
LVM version: 2.02.08 (2006-08-15)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
[root@calimero ~]# lvm lvresize --extents +1 /dev/vglinux1/lvswap2
Extending logical volume lvswap2 to 1,00 GB
device-mapper: reload ioctl failed: Argument invalide Failed to suspend lvswap2

~~
laurent

#5 lore raw
In reply to Luca Berra
Quoted 34 lines · Luca Berra
Quoted 33 lines · Laurent Riffard
Quoted 10 lines · Luca Berra
Quoted 9 lines · Alasdair G Kergon
Quoted 6 lines · Laurent Riffard

device-mapper: reload ioctl failed: Invalid argument

LVM version: 2.02.06 (2006-05-12)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
Linux version 2.6.18-rc6-mm1 ([email protected]) (gcc version 4.1.1 20060724 (prerelease) (4.1.1-3mdk)) #145 Sun Sep 10 20:48:49 CEST 2006

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Is it a known problem ?

Not sure, but try updating lvm2 version to the same date as the library version (at least 2.02.08 15th August).

Laurent, can you please try the packages from:
http://kenobi.mandriva.com/~bluca/

No luck!

[root@calimero ~]# rpm -q lvm2 libdevmapper1.02 lvm2-2.02.09-1mdv2007.0 libdevmapper1.02-1.02.09-1mdv2007.0
[root@calimero ~]# lvm2 version
LVM version: 2.02.09 (2006-08-17)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
[root@calimero ~]# lvresize --extents +1 /dev/vglinux1/lvswap2
Extending logical volume lvswap2 to 1,00 GB
device-mapper: reload ioctl failed: Argument invalide Failed to suspend lvswap2

Quoted 4 lines
Quoted 1 line

Will try vanilla to compile and test vanilla lvm2 2.02.08 as Alasdair suggested.

works for me with 2.6.17-4mdv kernel
maybe something related to your kernel version?

Well, I started to fail with Mandriva 2007 beta 2 and 3. Beta 3's kernel was kernel-2.6.17.2mdv-1-1mdv2007.0. So I'm not sure the kernel version has impact.

I planned to update to mandriva-free-2007 this evening. I'll keep you informed.

Another point is that I have some striped LV. Could it be related ?

[root@calimero ~]# lvdisplay -m /dev/vglinux1/lvswap
--- Logical volume ---

 LV Name                /dev/vglinux1/lvswap
 VG Name                vglinux1
 LV UUID                7rwfvs-tvQ4-gnT2-afC1-7yQA-PGMw-m0Zvac
 LV Write Access        read/write
 LV Status              available
 # open                 1
 LV Size                1,00 GB
 Current LE             256
 Segments               1
 Allocation             inherit
 Read ahead sectors     0
 Block device           254:8

--- Segments ---
Logical extent 0 to 255:

   Type                striped
   Stripes             2
   Stripe size         64 KB

Stripe 0:
Physical volume /dev/sdb7
Physical extents 1553 to 1680
Stripe 1:
Physical volume /dev/sda4
Physical extents 4424 to 4551

Should I try to compile and try a vanilla Device-mapper from http://sources.redhat.com/dm/ ?

~~
laurent

#6 lore raw
In reply to Luca Berra
Quoted 34 lines · Luca Berra
Quoted 33 lines · Laurent Riffard
Quoted 10 lines · Luca Berra
Quoted 9 lines · Alasdair G Kergon
Quoted 6 lines · Laurent Riffard

device-mapper: reload ioctl failed: Invalid argument

LVM version: 2.02.06 (2006-05-12)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
Linux version 2.6.18-rc6-mm1 ([email protected]) (gcc version 4.1.1 20060724 (prerelease) (4.1.1-3mdk)) #145 Sun Sep 10 20:48:49 CEST 2006

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Is it a known problem ?

Not sure, but try updating lvm2 version to the same date as the library version (at least 2.02.08 15th August).

Laurent, can you please try the packages from:
http://kenobi.mandriva.com/~bluca/

No luck!

[root@calimero ~]# rpm -q lvm2 libdevmapper1.02 lvm2-2.02.09-1mdv2007.0 libdevmapper1.02-1.02.09-1mdv2007.0
[root@calimero ~]# lvm2 version
LVM version: 2.02.09 (2006-08-17)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0
[root@calimero ~]# lvresize --extents +1 /dev/vglinux1/lvswap2
Extending logical volume lvswap2 to 1,00 GB
device-mapper: reload ioctl failed: Argument invalide Failed to suspend lvswap2

Quoted 4 lines
Quoted 1 line

Will try vanilla to compile and test vanilla lvm2 2.02.08 as Alasdair suggested.

works for me with 2.6.17-4mdv kernel
maybe something related to your kernel version?

Yes, you seem to be right: it does work with 2.6.17-2mdv or 2.6.17-4mdv, but it fails with 2.6.18-rc6-mm1.

[root@calimero ~]# lvm version
LVM version: 2.02.09 (2006-08-17)
Library version: 1.02.09 (2006-08-15)
Driver version: 4.8.0

Maybe, I'll test 2.6.18-rc6 tomorrow.

Thanks for your help.
~~
laurent

#7 lore raw

Hi Laurent,

Quoted 1 line · Laurent Riffard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

device-mapper: reload ioctl failed: Invalid argument

...

Quoted 4 lines
Quoted 2 lines

works for me with 2.6.17-4mdv kernel
maybe something related to your kernel version?

Yes, you seem to be right: it does work with 2.6.17-2mdv or 2.6.17-4mdv, but it fails with 2.6.18-rc6-mm1.

I reproduced the problem on my host, too.
I found a change in -mm which would cause this problem and attached patch fixed it.

I'll post it to linux-kernel as well.

Thanks,

Signature · 1 line
Jun'ichi Nomura, NEC Corporation of America

If a matching bd_holder is found in bd_holder_list, add_bd_holder() completes its job by just incrementing the reference count. In this case, it should be considered as success but it used to return 'fail' to let the caller free bd_holder.
Fixed it to return success and free given object by itself.

Also, if either one of symlinking fails, the bd_holder should not be added to the list so that it can be discarded later. Otherwise, the caller will free bd_holder which is in the list.

This patch is neccessary only for -mm (later than 2.6.18-rc1-mm1).

 fs/block_dev.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
fs/block_dev.c +7 -4
diff -urp linux-2.6.18-rc5-mm1.orig/fs/block_dev.c linux-2.6.18-rc5-mm1/fs/block_dev.c
@@ -655,8 +655,8 @@ static void free_bd_holder(struct bd_hol
  * If there is no matching entry with @bo in @bdev->bd_holder_list,
  * add @bo to the list, create symlinks.
  *
- * Returns 0 if @bo was added to the list.
- * Returns -ve if @bo wasn't used by any reason and should be freed.
+ * Returns 0 if symlinks are created or already there.
+ * Returns -ve if something fails and @bo can be freed.
  */
 static int add_bd_holder(struct block_device *bdev, struct bd_holder *bo)
 {
@@ -669,7 +669,9 @@ static int add_bd_holder(struct block_de
 	list_for_each_entry(tmp, &bdev->bd_holder_list, list) {
 		if (tmp->sdir == bo->sdir) {
 			tmp->count++;
-			return -EEXIST;
+			/* We've already done what we need to do here. */
+			free_bd_holder(bo);
+			return 0;
 		}
 	}
 
@@ -682,7 +684,8 @@ static int add_bd_holder(struct block_de
 		if (ret)
 			del_symlink(bo->sdir, bo->sdev);
 	}
-	list_add_tail(&bo->list, &bdev->bd_holder_list);
+	if (ret == 0)
+		list_add_tail(&bo->list, &bdev->bd_holder_list);
 	return ret;
 }
#8 lore raw
Quoted 10 lines · Jun'ichi Nomura

Hi Laurent,

Quoted 1 line · Laurent Riffard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

device-mapper: reload ioctl failed: Invalid argument

...

Quoted 4 lines
Quoted 2 lines

works for me with 2.6.17-4mdv kernel
maybe something related to your kernel version?

Yes, you seem to be right: it does work with 2.6.17-2mdv or 2.6.17-4mdv, but it fails with 2.6.18-rc6-mm1.

Quoted 7 lines

I reproduced the problem on my host, too.
I found a change in -mm which would cause this problem and attached patch fixed it.

I'll post it to linux-kernel as well.

Thanks,

Hi Jun'ichi,

I can confirm that your patch solved this problem.

- 2.6.18-rc6 works
- 2.6.18-rc6-mm1 fails
- 2.6.18-rc6-mm2 fails
- 2.6.18-rc6-mm2 + correct-add_bd_holder-return-value.patch works

Thanks!
--
laurent

Quoted 54 lines

------------------------------------------------------------------------

If a matching bd_holder is found in bd_holder_list, add_bd_holder() completes its job by just incrementing the reference count. In this case, it should be considered as success but it used to return 'fail' to let the caller free bd_holder.
Fixed it to return success and free given object by itself.

Also, if either one of symlinking fails, the bd_holder should not be added to the list so that it can be discarded later. Otherwise, the caller will free bd_holder which is in the list.

This patch is neccessary only for -mm (later than 2.6.18-rc1-mm1).

 fs/block_dev.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff -urp linux-2.6.18-rc5-mm1.orig/fs/block_dev.c linux-2.6.18-rc5-mm1/fs/block_dev.c

fs/block_dev.c +7 -4
@@ -655,8 +655,8 @@ static void free_bd_holder(struct bd_hol
  * If there is no matching entry with @bo in @bdev->bd_holder_list,
  * add @bo to the list, create symlinks.
  *
- * Returns 0 if @bo was added to the list.
- * Returns -ve if @bo wasn't used by any reason and should be freed.
+ * Returns 0 if symlinks are created or already there.
+ * Returns -ve if something fails and @bo can be freed.
  */
 static int add_bd_holder(struct block_device *bdev, struct bd_holder *bo)
 {
@@ -669,7 +669,9 @@ static int add_bd_holder(struct block_de
 	list_for_each_entry(tmp, &bdev->bd_holder_list, list) {
 		if (tmp->sdir == bo->sdir) {
 			tmp->count++;
-			return -EEXIST;
+			/* We've already done what we need to do here. */
+			free_bd_holder(bo);
+			return 0;
 		}
 	}
 
@@ -682,7 +684,8 @@ static int add_bd_holder(struct block_de
 		if (ret)
 			del_symlink(bo->sdir, bo->sdev);
 	}
-	list_add_tail(&bo->list, &bdev->bd_holder_list);
+	if (ret == 0)
+		list_add_tail(&bo->list, &bdev->bd_holder_list);
 	return ret;
 }