On 9/8/16 2:49 PM, Jeff Mahoney wrote: > On 9/8/16 2:24 PM, Ronan Arraes Jardim Chagas wrote: >> Hi all! >> >> Em Seg, 2016-09-05 às 16:49 +0800, Qu Wenruo escreveu: >>> Just like what Wang has mentioned, would you please paste all the >>> output >>> of the contents of /sys/fs/btrfs//allocation? >>> >>> It's recommended to use "grep . -IR " to get all the data as >>> it >>> will show the file name. >> >> So, one more time, I see the problem. This time I was just using >> Firefox and I cannot recover using `btrfs balance`. I think that, one >> more time, I will need to reboot this machine. This problem is really >> causing me a lot of troubles :( > > I have a hunch the list is about to be flooded with similar reports if > we don't find this one before 4.8. > > commit d555b6c380c644af63dbdaa7cc14bba041a4e4dd > Author: Josef Bacik > Date: Fri Mar 25 13:25:51 2016 -0400 > > Btrfs: warn_on for unaccounted spaces > > This commit isn't the source of the bug, but it's making it a lot more > noisy. I spent a few hours last night trying to track down why xfstests > was throwing these warnings and I was able to reproduce them at least as > far back as 4.4-vanilla with -oenospc_debug enabled. > > Speaking of which, can you turn on mounting with -oenospc_debug if you > haven't already? > > In my case, space_info->bytes_may_use was getting accounted incorrectly. > > I am able to reproduce that even with the following commit: > commit 18513091af9483ba84328d42092bd4d42a3c958f > Author: Wang Xiaoguang > Date: Mon Jul 25 15:51:40 2016 +0800 > > btrfs: update btrfs_space_info's bytes_may_use timely And the btrfs_free_reserved_data_space_noquota WARN_ON I was seeing is fixed by: commit ed7a6948394305b810d0c6203268648715e5006f Author: Wang Xiaoguang Date: Fri Aug 26 11:33:14 2016 +0800 btrfs: do not decrease bytes_may_use when replaying extents ... which shouldn't change anything for your issue, unfortunately. I still see these: WARNING: CPU: 2 PID: 8166 at ../fs/btrfs/extent-tree.c:9582 btrfs_free_block_groups+0x2a8/0x400 [btrfs]() Modules linked in: loop dm_flakey af_packet iscsi_ibft iscsi_boot_sysfs msr ext4 crc16 mbcache jbd2 ipmi_ssif dm_mod igb ptp pps_core acpi_cpufreq tpm_infineon kvm_amd ipmi_si kvm dca pcspkr ipmi_msghandler 8250_fintek sp5100_tco fjes irqbypass i2c_piix4 shpchp processor button amd64_edac_mod edac_mce_amd edac_core k10temp btrfs xor raid6_pq sd_mod ata_generic mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect ohci_pci sysimgblt ehci_pci serio_raw ohci_hcd fb_sys_fops pata_atiixp ehci_hcd ttm ahci libahci drm usbcore libata usb_common sg scsi_mod autofs4 CPU: 2 PID: 8166 Comm: umount Tainted: G W 4.4.19-11.g81405db-vanilla #1 Hardware name: HP ProLiant DL165 G7, BIOS O37 10/17/2012 0000000000000000 ffff880230317d10 ffffffff813170ec 0000000000000000 ffffffffa0472528 ffff880230317d48 ffffffff8107d816 0000000000000000 ffff88009ab03600 ffff8800ba106288 ffff8800ab75a000 ffff8800ba106200 Call Trace: [] dump_stack+0x63/0x87 [] warn_slowpath_common+0x86/0xc0 [] warn_slowpath_null+0x1a/0x20 [] btrfs_free_block_groups+0x2a8/0x400 [btrfs] [] close_ctree+0x15b/0x330 [btrfs] [] btrfs_put_super+0x19/0x20 [btrfs] [] generic_shutdown_super+0x6f/0x100 [] kill_anon_super+0x12/0x20 [] btrfs_kill_super+0x18/0x120 [btrfs] [] deactivate_locked_super+0x43/0x70 [] deactivate_super+0x46/0x60 [] cleanup_mnt+0x3f/0x80 [] __cleanup_mnt+0x12/0x20 [] task_work_run+0x86/0xb0 [] exit_to_usermode_loop+0x73/0xa2 [] syscall_return_slowpath+0x8d/0xa0 [] int_ret_from_sys_call+0x25/0x8f ---[ end trace 09a0cc2892b6305c ]--- BTRFS: space_info 1 has 7946240 free, is not full BTRFS: space_info total=8388608, used=442368, pinned=0, reserved=0, may_use=4096, readonly=0 ... where the value of may_use varies. -Jeff > >> grep . -IR /sys/fs/btrfs/e9efaa0c-d477-4249-830f- >> ee5956768b29/allocation >> allocation/data/flags:1 >> allocation/data/bytes_pinned:0 >> allocation/data/bytes_may_use:0 >> allocation/data/total_bytes_pinned:202973265920 > > That adds up to ~ 189 GB. total_bytes is only about 42 GB. > >> allocation/data/bytes_reserved:0 >> allocation/data/bytes_used:45623730176 >> allocation/data/single/used_bytes:45623730176 >> allocation/data/single/total_bytes:46179287040 >> allocation/data/total_bytes:46179287040 >> allocation/data/disk_total:46179287040 >> allocation/data/disk_used:45623730176 >> allocation/metadata/dup/used_bytes:1120698368 >> allocation/metadata/dup/total_bytes:6979321856 >> allocation/metadata/flags:4 >> allocation/metadata/bytes_pinned:0 >> allocation/metadata/bytes_may_use:88521768960 >> allocation/metadata/total_bytes_pinned:-44285952 > > ... well that's certainly interesting. It looks like we'll need to see > how that happened. It seems like we've messed up at least that portion > of accounting. > > -Jeff > >> allocation/metadata/bytes_reserved:0 >> allocation/metadata/bytes_used:1120698368 >> allocation/metadata/total_bytes:6979321856 >> allocation/metadata/disk_total:13958643712 >> allocation/metadata/disk_used:2241396736 >> allocation/global_rsv_size:385875968 >> allocation/global_rsv_reserved:385875968 >> allocation/system/dup/used_bytes:16384 >> allocation/system/dup/total_bytes:33554432 >> allocation/system/flags:2 >> allocation/system/bytes_pinned:0 >> allocation/system/bytes_may_use:0 >> allocation/system/total_bytes_pinned:0 >> allocation/system/bytes_reserved:0 >> allocation/system/bytes_used:16384 >> allocation/system/total_bytes:33554432 >> allocation/system/disk_total:67108864 >> allocation/system/disk_used:32768 >> >> Additional information: >> >> btrfs fi usage / >> Overall: >> Device size: 1.26TiB >> Device allocated: 56.07GiB >> Device unallocated: 1.20TiB >> Device missing: 0.00B >> Used: 44.58GiB >> Free (estimated): 1.20TiB (min: 616.41GiB) >> Data ratio: 1.00 >> Metadata ratio: 2.00 >> Global reserve: 368.00MiB (used: 0.00B) >> >> Data,single: Size:43.01GiB, Used:42.49GiB >> /dev/sda6 43.01GiB >> >> Metadata,DUP: Size:6.50GiB, Used:1.04GiB >> /dev/sda6 13.00GiB >> >> System,DUP: Size:32.00MiB, Used:16.00KiB >> /dev/sda6 64.00MiB >> >> Unallocated: >> /dev/sda6 1.20TiB >> >> Can anyone help me? >> >> Best regards, >> Ronan Arraes >> > > -- Jeff Mahoney SUSE Labs