* bug adding device to seed device, btrfs fi show fails
@ 2014-05-11 1:51 Chris Murphy
2014-05-11 3:38 ` Chris Murphy
2014-05-12 2:00 ` Anand Jain
0 siblings, 2 replies; 7+ messages in thread
From: Chris Murphy @ 2014-05-11 1:51 UTC (permalink / raw)
To: Btrfs BTRFS
kernel 3.15.0-0.rc5.git0.1.fc21.x86_64
btrfs-progs 3.14
/dev/sdb2 = existing btrfs fs
/dev/sdc3 = unformatted partition
# btrfstune -S1 /dev/sdb2
# mount /dev/sdb2 /mnt
mount: /dev/sdb2 is write-protected, mounting read-only
# btrfs device add /dev/sdc3 /mnt
Performing full device TRIM (75.90GiB) ...
# btrfs fi show
Label: 'rawhide' uuid: d372e5d1-386f-460c-b036-611469e0155e
Total devices 1 FS bytes used 7.55GiB
devid 1 size 79.31GiB used 11.04GiB path /dev/sda3
btrfs: utils.c:1769: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
Nothing listed in dmesg.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: bug adding device to seed device, btrfs fi show fails
2014-05-11 1:51 bug adding device to seed device, btrfs fi show fails Chris Murphy
@ 2014-05-11 3:38 ` Chris Murphy
2014-05-12 2:00 ` Anand Jain
1 sibling, 0 replies; 7+ messages in thread
From: Chris Murphy @ 2014-05-11 3:38 UTC (permalink / raw)
To: Btrfs BTRFS
On May 10, 2014, at 7:51 PM, Chris Murphy <lists@colorremedies.com> wrote:
> kernel 3.15.0-0.rc5.git0.1.fc21.x86_64
> btrfs-progs 3.14
>
> /dev/sdb2 = existing btrfs fs
> /dev/sdc3 = unformatted partition
>
>
> # btrfstune -S1 /dev/sdb2
> # mount /dev/sdb2 /mnt
> mount: /dev/sdb2 is write-protected, mounting read-only
> # btrfs device add /dev/sdc3 /mnt
> Performing full device TRIM (75.90GiB) ...
> # btrfs fi show
> Label: 'rawhide' uuid: d372e5d1-386f-460c-b036-611469e0155e
> Total devices 1 FS bytes used 7.55GiB
> devid 1 size 79.31GiB used 11.04GiB path /dev/sda3
>
> btrfs: utils.c:1769: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
The problem only happens when added device sdc3 is mounted at /mnt. Otherwise btrfs fi show works. The following is strace when added device sdc3 is mounted, while mount shows the seed device mounted:
# cat /proc/self/mountinfo
84 58 0:44 / /mnt rw,relatime shared:35 - btrfs /dev/sdb2 rw,seclabel,space_cache
# strace btrfs fi show
execve("/usr/sbin/btrfs", ["btrfs", "fi", "show"], [/* 24 vars */]) = 0
brk(0) = 0x2669000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae8d2c3000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=84288, ...}) = 0
mmap(NULL, 84288, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fae8d2ae000
close(3) = 0
open("/lib64/libuuid.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\25\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=19944, ...}) = 0
mmap(NULL, 2113920, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fae8ce9c000
mprotect(0x7fae8cea0000, 2093056, PROT_NONE) = 0
mmap(0x7fae8d09f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fae8d09f000
close(3) = 0
open("/lib64/libblkid.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\205\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=260640, ...}) = 0
mmap(NULL, 2353896, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fae8cc5d000
mprotect(0x7fae8cc97000, 2097152, PROT_NONE) = 0
mmap(0x7fae8ce97000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3a000) = 0x7fae8ce97000
mmap(0x7fae8ce9b000, 2792, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fae8ce9b000
close(3) = 0
open("/lib64/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20V\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1171192, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae8d2ad000
mmap(NULL, 3178856, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fae8c954000
mprotect(0x7fae8ca5c000, 2093056, PROT_NONE) = 0
mmap(0x7fae8cc5b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x107000) = 0x7fae8cc5b000
close(3) = 0
open("/lib64/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\"\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=89992, ...}) = 0
mmap(NULL, 2183688, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fae8c73e000
mprotect(0x7fae8c753000, 2093056, PROT_NONE) = 0
mmap(0x7fae8c952000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x7fae8c952000
close(3) = 0
open("/lib64/liblzo2.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0&\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=134440, ...}) = 0
mmap(NULL, 2228456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fae8c51d000
mprotect(0x7fae8c53d000, 2093056, PROT_NONE) = 0
mmap(0x7fae8c73c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1f000) = 0x7fae8c73c000
close(3) = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200`\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=145568, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae8d2ac000
mmap(NULL, 2213072, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fae8c300000
mprotect(0x7fae8c317000, 2097152, PROT_NONE) = 0
mmap(0x7fae8c517000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7fae8c517000
mmap(0x7fae8c519000, 13520, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fae8c519000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\1\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2125464, ...}) = 0
mmap(NULL, 3956544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fae8bf3a000
mprotect(0x7fae8c0f6000, 2097152, PROT_NONE) = 0
mmap(0x7fae8c2f6000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bc000) = 0x7fae8c2f6000
mmap(0x7fae8c2fc000, 16192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fae8c2fc000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae8d2ab000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae8d2a9000
arch_prctl(ARCH_SET_FS, 0x7fae8d2a9880) = 0
mprotect(0x7fae8c2f6000, 16384, PROT_READ) = 0
mprotect(0x7fae8c517000, 4096, PROT_READ) = 0
mprotect(0x7fae8c73c000, 4096, PROT_READ) = 0
mprotect(0x7fae8c952000, 4096, PROT_READ) = 0
mprotect(0x7fae8cc5b000, 4096, PROT_READ) = 0
mprotect(0x7fae8d09f000, 4096, PROT_READ) = 0
mprotect(0x7fae8ce97000, 12288, PROT_READ) = 0
mprotect(0x666000, 12288, PROT_READ) = 0
mprotect(0x7fae8d2c4000, 4096, PROT_READ) = 0
munmap(0x7fae8d2ae000, 84288) = 0
set_tid_address(0x7fae8d2a9b50) = 1111
set_robust_list(0x7fae8d2a9b60, 24) = 0
rt_sigaction(SIGRTMIN, {0x7fae8c305b60, [], SA_RESTORER|SA_SIGINFO, 0x7fae8c30f970}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7fae8c305bf0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7fae8c30f970}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
brk(0) = 0x2669000
brk(0x268a000) = 0x268a000
brk(0) = 0x268a000
open("/proc/self/mounts", O_RDONLY|O_CLOEXEC) = 3
futex(0x7fae8c2fd368, FUTEX_WAKE_PRIVATE, 2147483647) = 0
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae8d2c2000
read(3, "rootfs / rootfs rw,seclabel 0 0\n"..., 1024) = 1024
read(3, "cpuacct 0 0\ncgroup /sys/fs/cgrou"..., 1024) = 1024
stat("/", {st_mode=S_IFDIR|0755, st_size=132, ...}) = 0
stat("/", {st_mode=S_IFDIR|0755, st_size=132, ...}) = 0
openat(AT_FDCWD, "/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
ioctl(4, BTRFS_IOC_FS_INFO, 0x7fff21622990) = 0
ioctl(4, BTRFS_IOC_DEV_INFO, 0x26722a0) = -1 ENODEV (No such device)
ioctl(4, BTRFS_IOC_DEV_INFO, 0x26722a0) = 0
close(4) = 0
open("/", O_RDONLY|O_NOATIME) = 4
ioctl(4, BTRFS_IOC_GET_FSLABEL, 0x7fff21622800) = 0
close(4) = 0
open("/", O_RDONLY) = 4
ioctl(4, BTRFS_IOC_SPACE_INFO, 0x266a260) = 0
ioctl(4, BTRFS_IOC_SPACE_INFO, 0x266a280) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae8d2c1000
write(1, "Label: 'rawhide' uuid: d372e5d1"..., 61Label: 'rawhide' uuid: d372e5d1-386f-460c-b036-611469e0155e
) = 61
write(1, "\tTotal devices 1 FS bytes used 7"..., 39 Total devices 1 FS bytes used 7.55GiB
) = 39
open("/dev/sda3", O_RDONLY) = 5
close(5) = 0
write(1, "\tdevid 1 size 79.31GiB used 1"..., 55 devid 1 size 79.31GiB used 11.04GiB path /dev/sda3
) = 55
write(1, "\n", 1
) = 1
close(4) = 0
read(3, " rw,relatime 0 0\ntmpfs /tmp tmpf"..., 1024) = 574
stat("/home", {st_mode=S_IFDIR|0755, st_size=10, ...}) = 0
stat("/home", {st_mode=S_IFDIR|0755, st_size=10, ...}) = 0
openat(AT_FDCWD, "/home", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
ioctl(4, BTRFS_IOC_FS_INFO, 0x7fff21622990) = 0
ioctl(4, BTRFS_IOC_DEV_INFO, 0x26722c0) = -1 ENODEV (No such device)
ioctl(4, BTRFS_IOC_DEV_INFO, 0x26722c0) = 0
close(4) = 0
open("/home", O_RDONLY|O_NOATIME) = 4
ioctl(4, BTRFS_IOC_GET_FSLABEL, 0x7fff21622800) = 0
close(4) = 0
open("/home", O_RDONLY) = 4
ioctl(4, BTRFS_IOC_SPACE_INFO, 0x266a280) = 0
ioctl(4, BTRFS_IOC_SPACE_INFO, 0x266a2a0) = 0
close(4) = 0
stat("/var", {st_mode=S_IFDIR|0755, st_size=184, ...}) = 0
stat("/var", {st_mode=S_IFDIR|0755, st_size=184, ...}) = 0
openat(AT_FDCWD, "/var", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
ioctl(4, BTRFS_IOC_FS_INFO, 0x7fff21622990) = 0
ioctl(4, BTRFS_IOC_DEV_INFO, 0x26722c0) = -1 ENODEV (No such device)
ioctl(4, BTRFS_IOC_DEV_INFO, 0x26722c0) = 0
close(4) = 0
open("/var", O_RDONLY|O_NOATIME) = 4
ioctl(4, BTRFS_IOC_GET_FSLABEL, 0x7fff21622800) = 0
close(4) = 0
open("/var", O_RDONLY) = 4
ioctl(4, BTRFS_IOC_SPACE_INFO, 0x266a280) = 0
ioctl(4, BTRFS_IOC_SPACE_INFO, 0x266a2a0) = 0
close(4) = 0
stat("/mnt", {st_mode=S_IFDIR|0755, st_size=30, ...}) = 0
stat("/mnt", {st_mode=S_IFDIR|0755, st_size=30, ...}) = 0
openat(AT_FDCWD, "/mnt", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
ioctl(4, BTRFS_IOC_FS_INFO, 0x7fff21622990) = 0
ioctl(4, BTRFS_IOC_DEV_INFO, 0x26722c0) = -1 ENODEV (No such device)
ioctl(4, BTRFS_IOC_DEV_INFO, 0x26722c0) = 0
write(2, "btrfs: utils.c:1769: get_fs_info"..., 87btrfs: utils.c:1769: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
) = 87
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fae8d2c0000
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
tgkill(1111, 1111, SIGABRT) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=1111, si_uid=0} ---
+++ killed by SIGABRT (core dumped) +++
Aborted (core dumped)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: bug adding device to seed device, btrfs fi show fails
2014-05-11 1:51 bug adding device to seed device, btrfs fi show fails Chris Murphy
2014-05-11 3:38 ` Chris Murphy
@ 2014-05-12 2:00 ` Anand Jain
2014-05-13 9:12 ` Wang Shilong
1 sibling, 1 reply; 7+ messages in thread
From: Anand Jain @ 2014-05-12 2:00 UTC (permalink / raw)
To: Chris Murphy, Btrfs BTRFS
This patch posted a long time back should fix it.
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/33276
Could you test it ?
Thanks, Anand
On 05/11/2014 09:51 AM, Chris Murphy wrote:
> kernel 3.15.0-0.rc5.git0.1.fc21.x86_64
> btrfs-progs 3.14
>
> /dev/sdb2 = existing btrfs fs
> /dev/sdc3 = unformatted partition
>
>
> # btrfstune -S1 /dev/sdb2
> # mount /dev/sdb2 /mnt
> mount: /dev/sdb2 is write-protected, mounting read-only
> # btrfs device add /dev/sdc3 /mnt
> Performing full device TRIM (75.90GiB) ...
> # btrfs fi show
> Label: 'rawhide' uuid: d372e5d1-386f-460c-b036-611469e0155e
> Total devices 1 FS bytes used 7.55GiB
> devid 1 size 79.31GiB used 11.04GiB path /dev/sda3
>
> btrfs: utils.c:1769: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
>
> Nothing listed in dmesg.--
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: bug adding device to seed device, btrfs fi show fails
2014-05-12 2:00 ` Anand Jain
@ 2014-05-13 9:12 ` Wang Shilong
2014-08-14 4:05 ` Chris Murphy
0 siblings, 1 reply; 7+ messages in thread
From: Wang Shilong @ 2014-05-13 9:12 UTC (permalink / raw)
To: Anand Jain; +Cc: Chris Murphy, Btrfs BTRFS
Hi Anand,
On 05/12/2014 10:00 AM, Anand Jain wrote:
>
> This patch posted a long time back should fix it.
> http://permalink.gmane.org/gmane.comp.file-systems.btrfs/33276
I sent a patch to address another problem, plus your patch should can
fix the problem.
https://patchwork.kernel.org/patch/4163791/
Thanks,
Wang
>
> Could you test it ?
>
> Thanks, Anand
>
>
> On 05/11/2014 09:51 AM, Chris Murphy wrote:
>> kernel 3.15.0-0.rc5.git0.1.fc21.x86_64
>> btrfs-progs 3.14
>>
>> /dev/sdb2 = existing btrfs fs
>> /dev/sdc3 = unformatted partition
>>
>>
>> # btrfstune -S1 /dev/sdb2
>> # mount /dev/sdb2 /mnt
>> mount: /dev/sdb2 is write-protected, mounting read-only
>> # btrfs device add /dev/sdc3 /mnt
>> Performing full device TRIM (75.90GiB) ...
>> # btrfs fi show
>> Label: 'rawhide' uuid: d372e5d1-386f-460c-b036-611469e0155e
>> Total devices 1 FS bytes used 7.55GiB
>> devid 1 size 79.31GiB used 11.04GiB path /dev/sda3
>>
>> btrfs: utils.c:1769: get_fs_info: Assertion `!(ndevs >=
>> fi_args->num_devices)' failed.
>>
>> Nothing listed in dmesg.--
>> To unsubscribe from this list: send the line "unsubscribe
>> linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: bug adding device to seed device, btrfs fi show fails
2014-05-13 9:12 ` Wang Shilong
@ 2014-08-14 4:05 ` Chris Murphy
2014-08-14 4:37 ` Anand Jain
2014-08-14 4:42 ` Chris Murphy
0 siblings, 2 replies; 7+ messages in thread
From: Chris Murphy @ 2014-08-14 4:05 UTC (permalink / raw)
To: Btrfs BTRFS; +Cc: Anand Jain, Miao Xie, Wang Shilong
>> On 05/11/2014 09:51 AM, Chris Murphy wrote:
>>> kernel 3.15.0-0.rc5.git0.1.fc21.x86_64
>>> btrfs-progs 3.14
>>>
>>> /dev/sdb2 = existing btrfs fs
>>> /dev/sdc3 = unformatted partition
>>>
>>>
>>> # btrfstune -S1 /dev/sdb2
>>> # mount /dev/sdb2 /mnt
>>> mount: /dev/sdb2 is write-protected, mounting read-only
>>> # btrfs device add /dev/sdc3 /mnt
>>> Performing full device TRIM (75.90GiB) ...
>>> # btrfs fi show
>>> Label: 'rawhide' uuid: d372e5d1-386f-460c-b036-611469e0155e
>>> Total devices 1 FS bytes used 7.55GiB
>>> devid 1 size 79.31GiB used 11.04GiB path /dev/sda3
>>>
>>> btrfs: utils.c:1769: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
Old bug. I thought this patch would fix it, and see it is in integration branch. So I built a kernel and also btrfs-progs to test, but both 'fi show' and 'replace start' fail. However, 'device delete' works.
[PATCH 01/10] Btrfs: Fix the problem that the replace destroys the seed filesystem
https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg35774.html
This is what I just did. /dev/sdb is an existing btrfs volume not mounted, /dev/sdc is blank (a new VDI so it's definitely full of zeros.)
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 80G 0 disk
sdc 8:32 0 80G 0 disk
# btrfs fi show
Label: none uuid: caeaf998-6063-4c09-9088-0e05d4d4f54e
Total devices 1 FS bytes used 2.47GiB
devid 1 size 80.00GiB used 11.02GiB path /dev/sdb
Btrfs v3.14.2-167-ge514381
# btrfstune -S1 /dev/sdb
# mount /dev/sdb /mnt
mount: /dev/sdb is write-protected, mounting read-only
# btrfs device add /dev/sdc /mnt
# btrfs fi show
btrfs: utils.c:1939: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
Aborted (core dumped)
# umount /mnt
# mount /dev/sdc /mnt
# btrfs replace start -f 0 2 /mnt
btrfs: utils.c:1939: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
Aborted (core dumped)
# btrfs device delete /dev/sdc /mnt
ERROR: error removing the device '/dev/sdc' - unable to remove the only writeable device
# btrfs device delete /dev/sdb /mnt
The last command does complete and both /dev/sdb and /dev/sdc appear to work.
For above, this is what I get in dmesg:
[ 60.089303] sdb: unknown partition table
[ 69.945922] BTRFS info (device sdb): disk space caching is enabled
[ 69.969784] SELinux: initialized (dev sdb, type btrfs), uses xattr
[ 84.141416] sdc: unknown partition table
[ 84.180189] sdc: unknown partition table
[ 84.268800] BTRFS info (device sdb): relocating block group 12905873408 flags 2
[ 84.338819] BTRFS info (device sdb): relocating block group 0 flags 2
[ 84.393097] BTRFS info (device sdb): disk added /dev/sdc
[ 84.396880] sdc: unknown partition table
[ 341.031180] BTRFS info (device sdc): disk space caching is enabled
[ 341.050933] BTRFS: checking UUID tree
[ 341.053573] SELinux: initialized (dev sdc, type btrfs), uses xattr
[ 403.316005] BTRFS info (device sdc): relocating block group 10758389760 flags 1
[ 403.422962] BTRFS info (device sdc): found 35 extents
[ 403.561964] BTRFS info (device sdc): found 35 extents
[ 403.597289] BTRFS info (device sdc): relocating block group 9684647936 flags 1
[ 403.634505] BTRFS info (device sdc): relocating block group 8610906112 flags 1
[ 406.168389] BTRFS info (device sdc): found 2907 extents
[ 407.379575] BTRFS info (device sdc): found 2907 extents
[ 407.415344] BTRFS info (device sdc): relocating block group 7537164288 flags 1
[ 409.497717] BTRFS info (device sdc): found 613 extents
[ 412.010498] BTRFS info (device sdc): found 613 extents
[ 412.040723] BTRFS info (device sdc): relocating block group 6463422464 flags 1
[ 414.782188] BTRFS info (device sdc): found 1613 extents
[ 417.343576] BTRFS info (device sdc): found 1613 extents
[ 417.379543] BTRFS info (device sdc): relocating block group 5389680640 flags 1
[ 419.068584] BTRFS info (device sdc): found 1060 extents
[ 420.789650] BTRFS info (device sdc): found 1060 extents
[ 420.823006] BTRFS info (device sdc): relocating block group 4315938816 flags 1
[ 423.647962] BTRFS info (device sdc): found 3354 extents
[ 425.073006] BTRFS info (device sdc): found 3354 extents
[ 425.108412] BTRFS info (device sdc): relocating block group 3242196992 flags 1
[ 427.212816] BTRFS info (device sdc): found 2493 extents
[ 428.217004] BTRFS info (device sdc): found 2493 extents
[ 428.246424] BTRFS info (device sdc): relocating block group 2168455168 flags 1
[ 437.060542] BTRFS info (device sdc): found 22108 extents
[ 440.286964] BTRFS info (device sdc): found 22108 extents
[ 440.442528] BTRFS info (device sdc): relocating block group 1094713344 flags 1
[ 449.026968] BTRFS info (device sdc): found 3914 extents
[ 453.901003] BTRFS info (device sdc): found 3914 extents
[ 453.952946] BTRFS info (device sdc): relocating block group 20971520 flags 4
[ 454.848005] BTRFS info (device sdc): found 1352 extents
[ 454.903087] BTRFS info (device sdc): relocating block group 12582912 flags 1
[ 454.997235] BTRFS info (device sdc): found 46 extents
[ 455.169779] BTRFS info (device sdc): found 46 extents
[ 455.210596] BTRFS info (device sdc): relocating block group 4194304 flags 4
[ 455.261987] BTRFS info (device sdc): disk deleted /dev/sdb
[ 455.267911] sdb: unknown partition table
Looks like device delete did work; and now fi show also works.
# btrfs fi show
Label: none uuid: 9a072c79-db71-4bfb-914c-9ebf06215c3e
Total devices 1 FS bytes used 2.47GiB
devid 2 size 80.00GiB used 4.03GiB path /dev/sdc
Label: none uuid: caeaf998-6063-4c09-9088-0e05d4d4f54e
Total devices 1 FS bytes used 2.47GiB
devid 1 size 80.00GiB used 11.02GiB path /dev/sdb
The following patch is not in integration. Anand Jain asked me to try it in May for this problem, but I forgot.
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/33276
Should I try it?
Chris Murphy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: bug adding device to seed device, btrfs fi show fails
2014-08-14 4:05 ` Chris Murphy
@ 2014-08-14 4:37 ` Anand Jain
2014-08-14 4:42 ` Chris Murphy
1 sibling, 0 replies; 7+ messages in thread
From: Anand Jain @ 2014-08-14 4:37 UTC (permalink / raw)
To: Chris Murphy, Btrfs BTRFS; +Cc: Miao Xie, Wang Shilong
Chris,
For the seed replace issues. you have to try this patch set.
Thanks.
https://patchwork.kernel.org/patch/4716371/
Next, for the failing 'btrfs fi show' issue the following diff
is the latest. The last attempt was ..
[PATCH] btrfs: ioctl BTRFS_IOC_FS_INFO and BTRFS_IOC_DEV_INFO
miss-matched with slots
However as Wang mentioned we would need to show both seed and
sprout together, to make sense to the user.
So I have the following fix. which will soon be sent out
when tests are completed.
kernel:
-------------
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index da73ab3..05dd88b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2725,7 +2725,7 @@ static long btrfs_ioctl_fs_info(struct btrfs_root
*root, void __user *arg)
return -ENOMEM;
mutex_lock(&fs_devices->device_list_mutex);
- fi_args->num_devices = fs_devices->num_devices;
+ fi_args->num_devices = fs_devices->total_devices;
memcpy(&fi_args->fsid, root->fs_info->fsid, sizeof(fi_args->fsid));
list_for_each_entry_safe(device, next, &fs_devices->devices,
dev_list) {
----------------
btrfs-progs:
----------------
diff --git a/utils.c b/utils.c
index 8bdc2a7..fa837b9 100644
--- a/utils.c
+++ b/utils.c
@@ -1929,12 +1929,29 @@ int get_fs_info(char *path, struct
btrfs_ioctl_fs_info_args *fi_args,
if (!fi_args->num_devices)
goto out;
- di_args = *di_ret = malloc(fi_args->num_devices * sizeof(*di_args));
+ /*
+ * with kernel patch
+ * btrfs: ioctl BTRFS_IOC_FS_INFO and BTRFS_IOC_DEV_INFO
miss-matched with slots
+ * the kernel now returns total_devices which does not include
+ * replacing device if running. There might be a race condition
+ * where replace might have been completed before DEVS are
+ * probed. So we anyway probe the replacing at devid 0
+ * separately which would return -ENODEV if replace has
+ * finished.
+ */
+
+ di_args = *di_ret = malloc((fi_args->num_devices + 1) *
sizeof(*di_args));
if (!di_args) {
ret = -errno;
goto out;
}
+ /* get the replace target device if it is there */
+ ret = get_device_info(fd, i, &di_args[ndevs]);
+ if (!ret) {
+ ndevs++;
+ fi_args->num_devices++;
+ }
+ i++;
+
----------------
Thanks, Anand
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: bug adding device to seed device, btrfs fi show fails
2014-08-14 4:05 ` Chris Murphy
2014-08-14 4:37 ` Anand Jain
@ 2014-08-14 4:42 ` Chris Murphy
1 sibling, 0 replies; 7+ messages in thread
From: Chris Murphy @ 2014-08-14 4:42 UTC (permalink / raw)
To: Btrfs BTRFS; +Cc: Anand Jain, Miao Xie, Wang Shilong
On Aug 13, 2014, at 10:05 PM, Chris Murphy <lists@colorremedies.com> wrote:
>
>>> On 05/11/2014 09:51 AM, Chris Murphy wrote:
>>>> kernel 3.15.0-0.rc5.git0.1.fc21.x86_64
>>>> btrfs-progs 3.14
>>>>
>>>> /dev/sdb2 = existing btrfs fs
>>>> /dev/sdc3 = unformatted partition
>>>>
>>>>
>>>> # btrfstune -S1 /dev/sdb2
>>>> # mount /dev/sdb2 /mnt
>>>> mount: /dev/sdb2 is write-protected, mounting read-only
>>>> # btrfs device add /dev/sdc3 /mnt
>>>> Performing full device TRIM (75.90GiB) ...
>>>> # btrfs fi show
>>>> Label: 'rawhide' uuid: d372e5d1-386f-460c-b036-611469e0155e
>>>> Total devices 1 FS bytes used 7.55GiB
>>>> devid 1 size 79.31GiB used 11.04GiB path /dev/sda3
>>>>
>>>> btrfs: utils.c:1769: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
>
> Old bug. I thought this patch would fix it, and see it is in integration branch. So I built a kernel and also btrfs-progs to test, but both 'fi show' and 'replace start' fail. However, 'device delete' works.
>
> [PATCH 01/10] Btrfs: Fix the problem that the replace destroys the seed filesystem
> https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg35774.html
>
>
> This is what I just did. /dev/sdb is an existing btrfs volume not mounted, /dev/sdc is blank (a new VDI so it's definitely full of zeros.)
>
> # lsblk
> NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
> sdb 8:16 0 80G 0 disk
> sdc 8:32 0 80G 0 disk
> # btrfs fi show
> Label: none uuid: caeaf998-6063-4c09-9088-0e05d4d4f54e
> Total devices 1 FS bytes used 2.47GiB
> devid 1 size 80.00GiB used 11.02GiB path /dev/sdb
>
> Btrfs v3.14.2-167-ge514381
> # btrfstune -S1 /dev/sdb
> # mount /dev/sdb /mnt
> mount: /dev/sdb is write-protected, mounting read-only
> # btrfs device add /dev/sdc /mnt
> # btrfs fi show
> btrfs: utils.c:1939: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
> Aborted (core dumped)
> # umount /mnt
> # mount /dev/sdc /mnt
> # btrfs replace start -f 0 2 /mnt
> btrfs: utils.c:1939: get_fs_info: Assertion `!(ndevs >= fi_args->num_devices)' failed.
> Aborted (core dumped)
> # btrfs device delete /dev/sdc /mnt
> ERROR: error removing the device '/dev/sdc' - unable to remove the only writeable device
> # btrfs device delete /dev/sdb /mnt
>
> The last command does complete and both /dev/sdb and /dev/sdc appear to work.
>
> For above, this is what I get in dmesg:
> [ 60.089303] sdb: unknown partition table
> [ 69.945922] BTRFS info (device sdb): disk space caching is enabled
> [ 69.969784] SELinux: initialized (dev sdb, type btrfs), uses xattr
> [ 84.141416] sdc: unknown partition table
> [ 84.180189] sdc: unknown partition table
> [ 84.268800] BTRFS info (device sdb): relocating block group 12905873408 flags 2
> [ 84.338819] BTRFS info (device sdb): relocating block group 0 flags 2
> [ 84.393097] BTRFS info (device sdb): disk added /dev/sdc
> [ 84.396880] sdc: unknown partition table
> [ 341.031180] BTRFS info (device sdc): disk space caching is enabled
> [ 341.050933] BTRFS: checking UUID tree
> [ 341.053573] SELinux: initialized (dev sdc, type btrfs), uses xattr
> [ 403.316005] BTRFS info (device sdc): relocating block group 10758389760 flags 1
> [ 403.422962] BTRFS info (device sdc): found 35 extents
> [ 403.561964] BTRFS info (device sdc): found 35 extents
> [ 403.597289] BTRFS info (device sdc): relocating block group 9684647936 flags 1
> [ 403.634505] BTRFS info (device sdc): relocating block group 8610906112 flags 1
> [ 406.168389] BTRFS info (device sdc): found 2907 extents
> [ 407.379575] BTRFS info (device sdc): found 2907 extents
> [ 407.415344] BTRFS info (device sdc): relocating block group 7537164288 flags 1
> [ 409.497717] BTRFS info (device sdc): found 613 extents
> [ 412.010498] BTRFS info (device sdc): found 613 extents
> [ 412.040723] BTRFS info (device sdc): relocating block group 6463422464 flags 1
> [ 414.782188] BTRFS info (device sdc): found 1613 extents
> [ 417.343576] BTRFS info (device sdc): found 1613 extents
> [ 417.379543] BTRFS info (device sdc): relocating block group 5389680640 flags 1
> [ 419.068584] BTRFS info (device sdc): found 1060 extents
> [ 420.789650] BTRFS info (device sdc): found 1060 extents
> [ 420.823006] BTRFS info (device sdc): relocating block group 4315938816 flags 1
> [ 423.647962] BTRFS info (device sdc): found 3354 extents
> [ 425.073006] BTRFS info (device sdc): found 3354 extents
> [ 425.108412] BTRFS info (device sdc): relocating block group 3242196992 flags 1
> [ 427.212816] BTRFS info (device sdc): found 2493 extents
> [ 428.217004] BTRFS info (device sdc): found 2493 extents
> [ 428.246424] BTRFS info (device sdc): relocating block group 2168455168 flags 1
> [ 437.060542] BTRFS info (device sdc): found 22108 extents
> [ 440.286964] BTRFS info (device sdc): found 22108 extents
> [ 440.442528] BTRFS info (device sdc): relocating block group 1094713344 flags 1
> [ 449.026968] BTRFS info (device sdc): found 3914 extents
> [ 453.901003] BTRFS info (device sdc): found 3914 extents
> [ 453.952946] BTRFS info (device sdc): relocating block group 20971520 flags 4
> [ 454.848005] BTRFS info (device sdc): found 1352 extents
> [ 454.903087] BTRFS info (device sdc): relocating block group 12582912 flags 1
> [ 454.997235] BTRFS info (device sdc): found 46 extents
> [ 455.169779] BTRFS info (device sdc): found 46 extents
> [ 455.210596] BTRFS info (device sdc): relocating block group 4194304 flags 4
> [ 455.261987] BTRFS info (device sdc): disk deleted /dev/sdb
> [ 455.267911] sdb: unknown partition table
>
> Looks like device delete did work; and now fi show also works.
>
> # btrfs fi show
> Label: none uuid: 9a072c79-db71-4bfb-914c-9ebf06215c3e
> Total devices 1 FS bytes used 2.47GiB
> devid 2 size 80.00GiB used 4.03GiB path /dev/sdc
>
> Label: none uuid: caeaf998-6063-4c09-9088-0e05d4d4f54e
> Total devices 1 FS bytes used 2.47GiB
> devid 1 size 80.00GiB used 11.02GiB path /dev/sdb
>
>
> The following patch is not in integration. Anand Jain asked me to try it in May for this problem, but I forgot.
>
> http://permalink.gmane.org/gmane.comp.file-systems.btrfs/33276
>
> Should I try it?
Looks like it was withdrawn. Maybe this one?
[PATCH] btrfs: ioctl BTRFS_IOC_FS_INFO and BTRFS_IOC_DEV_INFO miss-matched with slots
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/35157
Chris Murphy
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-08-14 4:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-11 1:51 bug adding device to seed device, btrfs fi show fails Chris Murphy
2014-05-11 3:38 ` Chris Murphy
2014-05-12 2:00 ` Anand Jain
2014-05-13 9:12 ` Wang Shilong
2014-08-14 4:05 ` Chris Murphy
2014-08-14 4:37 ` Anand Jain
2014-08-14 4:42 ` Chris Murphy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).