On 2021/3/2 上午1:24, Christian Völker wrote:
Hi, just a little update on the issue. As soon as I omit the encryption part I can easily add the device to the btrfs filesystem. It does not matter if the crypted device is on top of DRBD or directly on the /dev/sdc. In both cases btrs refuses to add the device when a luks-encrypted device is on top. In case I am swapping my setup (drbd on top of encryption) and add the drbd device to btrfs it works without any issues. However, I prefer the other way round- and as the other two btrfs devices are both encryption on top of drbd it should work... It appears it does not like to add a third device-mapper device... Let me know how I can help in debugging. If i have some time I will setup a machine trying to reproduce this.
Got the problem reproduced here. And surprisingly, it's something related to btrfs-progs, not the kernel. I just added one debug info in btrfs-progs, it shows: $ sudo ./btrfs dev add /dev/test/scratch2 /mnt/btrfs cmd_device_add: path=dm-5 ERROR: error adding device 'dm-5': No such file or directory See the problem? The path which should be passed to kernel lacks the "/dev/test/" prefix, thus it's not pointing to correct path and cause the ENOENT error, since there is no "dm-5" in current path. Thankfully it's already fixed in devel branch with commit 2347b34af4d8 ("btrfs-progs: fix device mapper path canonicalization"). The offending patch is 922eaa7b5472 ("btrfs-progs: build: fix linking with static libmount"), which is in v5.10.1. You can revert back to v5.10 to workaroud it. TO David, Would you consider to add a new v5.10.2 to fix the problem? As it seems to affect the end user quite badly. Thanks, Qu
any ideas otherwise? Let me know! Thanks! /KNEBB