All of lore.kernel.org
 help / color / mirror / Atom feed
* lvresize fails with "reload ioctl failed: Invalid argument"
@ 2006-09-10 21:38 Laurent Riffard
  2006-09-10 22:14 ` Alasdair G Kergon
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Riffard @ 2006-09-10 21:38 UTC (permalink / raw)
  To: dm-devel

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 (laurent@calimero.antadix) (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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: lvresize fails with "reload ioctl failed: Invalid argument"
  2006-09-10 21:38 lvresize fails with "reload ioctl failed: Invalid argument" Laurent Riffard
@ 2006-09-10 22:14 ` Alasdair G Kergon
  2006-09-11 14:19   ` Luca Berra
  2006-09-11 17:18   ` Laurent Riffard
  0 siblings, 2 replies; 10+ messages in thread
From: Alasdair G Kergon @ 2006-09-10 22:14 UTC (permalink / raw)
  To: device-mapper development

On Sun, Sep 10, 2006 at 11:38:27PM +0200, Laurent Riffard wrote:
>  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 (laurent@calimero.antadix) (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
-- 
agk@redhat.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: lvresize fails with "reload ioctl failed: Invalid argument"
  2006-09-10 22:14 ` Alasdair G Kergon
@ 2006-09-11 14:19   ` Luca Berra
  2006-09-11 16:45     ` Laurent Riffard
  2006-09-11 17:18   ` Laurent Riffard
  1 sibling, 1 reply; 10+ messages in thread
From: Luca Berra @ 2006-09-11 14:19 UTC (permalink / raw)
  To: dm-devel

On Sun, Sep 10, 2006 at 11:14:27PM +0100, Alasdair G Kergon wrote:
>On Sun, Sep 10, 2006 at 11:38:27PM +0200, Laurent Riffard wrote:
>>  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 (laurent@calimero.antadix) (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).
>
Laurent, can you please try the packages from:
http://kenobi.mandriva.com/~bluca/

10x
L.

-- 
Luca Berra -- bluca@comedia.it
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: lvresize fails with "reload ioctl failed: Invalid argument"
  2006-09-11 14:19   ` Luca Berra
@ 2006-09-11 16:45     ` Laurent Riffard
  2006-09-11 17:05       ` Luca Berra
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Riffard @ 2006-09-11 16:45 UTC (permalink / raw)
  To: dm-devel

Le 11.09.2006 16:19, Luca Berra a écrit :
> On Sun, Sep 10, 2006 at 11:14:27PM +0100, Alasdair G Kergon wrote:
>> On Sun, Sep 10, 2006 at 11:38:27PM +0200, Laurent Riffard wrote:
>>>  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 (laurent@calimero.antadix) (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).
>>
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: lvresize fails with "reload ioctl failed: Invalid argument"
  2006-09-11 16:45     ` Laurent Riffard
@ 2006-09-11 17:05       ` Luca Berra
  2006-09-11 18:23         ` Laurent Riffard
  2006-09-11 20:14         ` Laurent Riffard
  0 siblings, 2 replies; 10+ messages in thread
From: Luca Berra @ 2006-09-11 17:05 UTC (permalink / raw)
  To: dm-devel

On Mon, Sep 11, 2006 at 06:45:57PM +0200, Laurent Riffard wrote:
>Le 11.09.2006 16:19, Luca Berra a écrit :
>>On Sun, Sep 10, 2006 at 11:14:27PM +0100, Alasdair G Kergon wrote:
>>>On Sun, Sep 10, 2006 at 11:38:27PM +0200, Laurent Riffard wrote:
>>>>  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 (laurent@calimero.antadix) (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).
>>>
>>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.

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

L.


-- 
Luca Berra -- bluca@comedia.it
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: lvresize fails with "reload ioctl failed: Invalid argument"
  2006-09-10 22:14 ` Alasdair G Kergon
  2006-09-11 14:19   ` Luca Berra
@ 2006-09-11 17:18   ` Laurent Riffard
  1 sibling, 0 replies; 10+ messages in thread
From: Laurent Riffard @ 2006-09-11 17:18 UTC (permalink / raw)
  To: device-mapper development, Alasdair G Kergon

Le 11.09.2006 00:14, Alasdair G Kergon a écrit :
> On Sun, Sep 10, 2006 at 11:38:27PM +0200, Laurent Riffard wrote:
>>  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 (laurent@calimero.antadix) (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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: lvresize fails with "reload ioctl failed: Invalid argument"
  2006-09-11 17:05       ` Luca Berra
@ 2006-09-11 18:23         ` Laurent Riffard
  2006-09-11 20:14         ` Laurent Riffard
  1 sibling, 0 replies; 10+ messages in thread
From: Laurent Riffard @ 2006-09-11 18:23 UTC (permalink / raw)
  To: dm-devel, Luca Berra

Le 11.09.2006 19:05, Luca Berra a écrit :
> On Mon, Sep 11, 2006 at 06:45:57PM +0200, Laurent Riffard wrote:
>> Le 11.09.2006 16:19, Luca Berra a écrit :
>>> On Sun, Sep 10, 2006 at 11:14:27PM +0100, Alasdair G Kergon wrote:
>>>> On Sun, Sep 10, 2006 at 11:38:27PM +0200, Laurent Riffard wrote:
>>>>>  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 (laurent@calimero.antadix) (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).
>>>>
>>> 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.
> 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: lvresize fails with "reload ioctl failed: Invalid argument"
  2006-09-11 17:05       ` Luca Berra
  2006-09-11 18:23         ` Laurent Riffard
@ 2006-09-11 20:14         ` Laurent Riffard
  2006-09-12  0:19           ` Jun'ichi Nomura
  1 sibling, 1 reply; 10+ messages in thread
From: Laurent Riffard @ 2006-09-11 20:14 UTC (permalink / raw)
  To: dm-devel

Le 11.09.2006 19:05, Luca Berra a écrit :
> On Mon, Sep 11, 2006 at 06:45:57PM +0200, Laurent Riffard wrote:
>> Le 11.09.2006 16:19, Luca Berra a écrit :
>>> On Sun, Sep 10, 2006 at 11:14:27PM +0100, Alasdair G Kergon wrote:
>>>> On Sun, Sep 10, 2006 at 11:38:27PM +0200, Laurent Riffard wrote:
>>>>>  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 (laurent@calimero.antadix) (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).
>>>>
>>> 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.
> 
> 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
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: lvresize fails with "reload ioctl failed: Invalid argument"
  2006-09-11 20:14         ` Laurent Riffard
@ 2006-09-12  0:19           ` Jun'ichi Nomura
  2006-09-12 20:57             ` Laurent Riffard
  0 siblings, 1 reply; 10+ messages in thread
From: Jun'ichi Nomura @ 2006-09-12  0:19 UTC (permalink / raw)
  To: device-mapper development

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]

Hi Laurent,

Laurent Riffard wrote:
>>>>>>  device-mapper: reload ioctl failed: Invalid argument
...
>> 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,
-- 
Jun'ichi Nomura, NEC Corporation of America

[-- Attachment #2: correct-add_bd_holder-return-value.patch --]
[-- Type: text/x-patch, Size: 1970 bytes --]

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(-)

Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>

diff -urp linux-2.6.18-rc5-mm1.orig/fs/block_dev.c linux-2.6.18-rc5-mm1/fs/block_dev.c
--- linux-2.6.18-rc5-mm1.orig/fs/block_dev.c	2006-09-11 19:33:35.000000000 -0400
+++ linux-2.6.18-rc5-mm1/fs/block_dev.c	2006-09-11 19:21:46.000000000 -0400
@@ -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;
 }

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: lvresize fails with "reload ioctl failed: Invalid argument"
  2006-09-12  0:19           ` Jun'ichi Nomura
@ 2006-09-12 20:57             ` Laurent Riffard
  0 siblings, 0 replies; 10+ messages in thread
From: Laurent Riffard @ 2006-09-12 20:57 UTC (permalink / raw)
  To: dm-devel

Le 12.09.2006 02:19, Jun'ichi Nomura a écrit :
> Hi Laurent,
> 
> Laurent Riffard wrote:
>>>>>>>  device-mapper: reload ioctl failed: Invalid argument
> ...
>>> 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,

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

> ------------------------------------------------------------------------
> 
> 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(-)
> 
> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
> 
> diff -urp linux-2.6.18-rc5-mm1.orig/fs/block_dev.c linux-2.6.18-rc5-mm1/fs/block_dev.c
> --- linux-2.6.18-rc5-mm1.orig/fs/block_dev.c	2006-09-11 19:33:35.000000000 -0400
> +++ linux-2.6.18-rc5-mm1/fs/block_dev.c	2006-09-11 19:21:46.000000000 -0400
> @@ -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;
>  }
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-09-12 20:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-10 21:38 lvresize fails with "reload ioctl failed: Invalid argument" Laurent Riffard
2006-09-10 22:14 ` Alasdair G Kergon
2006-09-11 14:19   ` Luca Berra
2006-09-11 16:45     ` Laurent Riffard
2006-09-11 17:05       ` Luca Berra
2006-09-11 18:23         ` Laurent Riffard
2006-09-11 20:14         ` Laurent Riffard
2006-09-12  0:19           ` Jun'ichi Nomura
2006-09-12 20:57             ` Laurent Riffard
2006-09-11 17:18   ` Laurent Riffard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.