[linux-lvm] Can't get merge in background using blockdev api to work

Tomas Dalebjörk tomas.dalebjork at gmail.com
Wed Jan 5 08:12:49 UTC 2022


Hi Vojtech,

Thanks for looking it up.
It looks like the merging started in the background after all.

But here is the issue..

Merge initiates at 2022-01-04 17:40:31
2022-01-04.17:40:31 MERGELV

And I do get a return code of that it starting in background, as the next
command is executed, that tries to mount the filesystem
2022-01-04.17:40:37 MOUNTFS

But, in the kernel log I can see these errors from mountfs, which I looping
with a retry every 1s until it can get mounted

Jan  4 17:40:38 debian10 kernel: [42138.075811] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:39 debian10 kernel: [42139.522164] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:41 debian10 kernel: [42140.877383] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:42 debian10 kernel: [42142.337237] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:43 debian10 kernel: [42143.757615] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:45 debian10 kernel: [42145.155576] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:46 debian10 kernel: [42146.277236] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:47 debian10 kernel: [42147.287412] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:48 debian10 kernel: [42148.317816] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:49 debian10 kernel: [42149.322470] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:50 debian10 kernel: [42150.332581] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:51 debian10 kernel: [42151.334976] XFS (dm-6): device supports
1024 byte sectors (not 512)
Jan  4 17:40:52 debian10 kernel: [42152.337999] XFS (dm-6): device supports
1024 byte sectors (not 512)

And the mountfs loop only ends when the merge has completed, hence the
question of if it really works in the background?

The merge ends when the next command is about to be executed, where I am
trying to reduce the disk from the volume group

2022-01-04.17:40:53  VGREDUCE

And there are no indication of any file system errors either

Jan  4 17:40:53 debian10 kernel: [42153.374758] XFS (dm-6): Mounting V5
Filesystem
Jan  4 17:40:53 debian10 kernel: [42153.378430] XFS (dm-6): Starting
recovery (logdev: internal)
Jan  4 17:40:53 debian10 kernel: [42153.378741] XFS (dm-6): Ending recovery
(logdev: internal)
Jan  4 17:41:53 debian10 kernel: [42213.622453] block nbd3: NBD_DISCONNECT

I have not analyzed into this more deeply, but could it be that LVM merge
has a pre-phase  step, where it has to scan all the blocks first before
actually starting a merge?
Because that can explain why, as our disks are emulated block device coming
from the nmd devices

Or do you have any tips that can lead us into the right track?

Regards Tomas

Den tis 4 jan. 2022 kl 09:09 skrev Vojtech Trefny <vtrefny at redhat.com>:

> Hi, libblockdev maintainer here, libblockdev is a separate project from
> LVM so it's better to ask on our GitHub[1], but I'm reading this ML too so
> I can answer here.
>
> I did a quick test and the background merge works for me, so I think the
> problem is somewhere in LVM or with your setup, not in libblockdev -- all
> we do is run the "lvm lvconvert --merge <vg>/<snap> --background" command
> so there isn't a big room for a bug in our code (but I'm not saying there
> isn't one). I've modified your code a little bit[2], can you try running it
> again? I've just added logging so we can see what we actually tell LVM to
> run and also enabled LVM logging and saved the log to /tmp/lvm.log.
>
> [1] https://github.com/storaged-project/libblockdev
> [2] https://gist.github.com/vojtechtrefny/7f379596958a0c4cd4c287c3f7a7dddd
>
> On Mon, Jan 3, 2022 at 9:06 AM Tomas Dalebjörk <tomas.dalebjork at gmail.com>
> wrote:
>
>> Hi,
>>
>> I am trying to start a merge to the previous snapshot to be started with
>> the "-b" flag (background). But it seems to be that the merging has not
>> started in the background at all.
>>
>>         BDExtraArg      lv_arg = {"--background",""};
>>         const BDExtraArg        *extra_args[2] = {&lv_arg, NULL};
>>
>>         BDPluginSpec lvm_plugin = {BD_PLUGIN_LVM, "libbd_lvm.so.2"};
>>         BDPluginSpec *plugins[] = {&lvm_plugin,NULL};
>>
>>         bd_switch_init_checks (FALSE, &error);
>>         bd_ensure_init (plugins, NULL, &error);
>>         bd_lvm_lvsnapshotmerge(vg_name,lv_snap,extra_args,&error);
>>
>> Couldn't find any details about how to do this using the libblockdev api,
>> but according to the documentation, it should be possible to add the same
>> flags as for the normal LVM commands.
>>
>> Could you please give me a hint of what I am doing wrong?
>>
>> Regards Tomas
>>
>> _______________________________________________
>> linux-lvm mailing list
>> linux-lvm at redhat.com
>> https://listman.redhat.com/mailman/listinfo/linux-lvm
>> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at redhat.com
> https://listman.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20220105/29693472/attachment.htm>


More information about the linux-lvm mailing list