Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steam on Linux makes BTRFS drive converted from NTFS read-only #51

Closed
kleinermob opened this issue Aug 2, 2022 · 16 comments
Closed

Steam on Linux makes BTRFS drive converted from NTFS read-only #51

kleinermob opened this issue Aug 2, 2022 · 16 comments

Comments

@kleinermob
Copy link

On Windows everything works fine, but on Linux when trying to install a game or update a game, my converted drive turns into read-only

output of command "journalctl -p3 --since "today" | grep BTRFS"

Aug 02 16:03:18 localhost kernel: BTRFS error (device nvme0n1p6): qgroup generation mismatch, marked as inconsistent
Aug 02 14:06:04 localhost.localdomain kernel: BTRFS error (device sda1): unable to find ref byte nr 124385026048 parent 0 root 5 owner 33353 offset 0
Aug 02 14:06:04 localhost.localdomain kernel: BTRFS: error (device sda1: state A) in __btrfs_free_extent:3094: errno=-2 No such entry
Aug 02 14:06:04 localhost.localdomain kernel: BTRFS: error (device sda1: state EA) in btrfs_run_delayed_refs:2151: errno=-2 No such entry
Aug 02 14:08:45 localhost.localdomain kernel: BTRFS error (device sda1): unable to find ref byte nr 670268948480 parent 0 root 5 owner 92017 offset 0
Aug 02 14:08:45 localhost.localdomain kernel: BTRFS: error (device sda1: state A) in __btrfs_free_extent:3094: errno=-2 No such entry
Aug 02 14:08:45 localhost.localdomain kernel: BTRFS: error (device sda1: state EA) in btrfs_run_delayed_refs:2151: errno=-2 No such entry
Aug 02 14:14:03 localhost.localdomain kernel: BTRFS error (device sda1): unable to find ref byte nr 670268948480 parent 0 root 5 owner 92017 offset 0
Aug 02 14:14:03 localhost.localdomain kernel: BTRFS: error (device sda1: state A) in __btrfs_free_extent:3094: errno=-2 No such entry
Aug 02 14:14:03 localhost.localdomain kernel: BTRFS: error (device sda1: state EA) in btrfs_run_delayed_refs:2151: errno=-2 No such entry

drive was converted via Version 20210923

@maharmstone
Copy link
Owner

What does btrfs check say?

@Redemption198
Copy link

Redemption198 commented Aug 5, 2022

It is also happening to me, but it automatically mounts in read only at random or at boot.

btrfs check

Errors at boot journalctl -p3 --since "today" | grep BTRFS:

kernel: BTRFS error (device sda1): unable to find ref byte nr 254322663424 parent 0 root 5 owner 322810 offset 0
kernel: BTRFS: error (device sda1: state A) in __btrfs_free_extent:3094: errno=-2 No such entry
kernel: BTRFS: error (device sda1: state EA) in btrfs_run_delayed_refs:2151: errno=-2 No such entry

I also tried btrfs check --repair (I know it's unrecommended)

Note: I've had to compile ntfs2btrfs myself from last commit, since the one available in the Fedora repo is outdated and throws an error when used

Update: I rolled back do ntfs

@kleinermob
Copy link
Author

Btrfs check reported nothing, i reformatted my drive, so i cant report any further.

@maharmstone
Copy link
Owner

If btrfs check says the volume is clean but it causes problems in Linux, that's a bug in either btrfs-progs or the kernel (as well as maybe ntfs2btrfs).

Try the latest version of btrfs-progs if you can (5.18.1, I think) - I have a couple of patches in btrfs-check for undiagnosed mistakes that ntfs2btrfs was making.

@StaticFunk
Copy link

I think I have a similar error? I get it after using qbittorrent for a few minutes downloading to the converted partition.

journalctl -p3 --since "today" | grep BTRFS
whole dmesg error when it goes read-only
btrfs check

I haven't run --repair and I still have the partition around so let me know if you need more info or if I should just accept it's borked and do a recovery.

@jvesely
Copy link

jvesely commented Oct 2, 2022

I ran into this same problem converting ntfs drive with steam library to btrfs went OK. the drive mounts OK, but any manipulation of the files results in:

[ 4231.026116] ------------[ cut here ]------------
[ 4231.026121] WARNING: CPU: 4 PID: 30119 at fs/btrfs/extent-tree.c:3073 __btrfs_free_extent+0x723/0xa50 [btrfs]
[ 4231.026190] Modules linked in: rfcomm bnep iwlmvm mac80211 libarc4 snd_ctl_led snd_hda_codec_conexant kvm_amd iwlwifi wmi_bmof snd_hda_codec_generic uvcvideo kvm snd_hda_codec_hdmi videobuf2_vmalloc videobuf2_memops snd_hda_intel btusb videobuf2_v4l2 snd_intel_dspcfg btrtl snd_hda_codec btintel irqbypass videobuf2_common bluetooth tpm_crb snd_hwdep cfg80211 snd_hda_core snd_pcm i2c_piix4 wmi tpm_tis tpm_tis_core i2c_scmi fuse amdgpu drm_ttm_helper ttm mfd_core iommu_v2 crc32_pclmul ucsi_acpi uas gpu_sched sdhci_pci drm_display_helper thinkpad_acpi typec_ucsi usb_storage iosf_mbi ccp typec cec cqhci platform_profile btrfs xor raid6_pq zstd_compress
[ 4231.026261] CPU: 4 PID: 30119 Comm: sync Tainted: G        W       T 5.19.12-gentoo #1
[ 4231.026266] Hardware name: LENOVO 20KUCTO1WW/20KUCTO1WW, BIOS R0UET82W (1.62 ) 08/11/2022
[ 4231.026269] RIP: 0010:__btrfs_free_extent+0x723/0xa50 [btrfs]
[ 4231.026330] Code: 48 05 58 0a 00 00 f0 48 0f ba 28 03 0f 82 a1 80 0c 00 be 8b ff ff ff 48 c7 c7 20 2f 67 c0 e8 f0 22 68 e3 0f 0b e9 89 80 0c 00 <0f> 0b 49 8b 3e e8 83 5c 00 00 48 8b 44 24 30 4c 8b 4c 24 18 4d 89
[ 4231.026334] RSP: 0018:ffffb3084b537bc0 EFLAGS: 00010246
[ 4231.026338] RAX: 00000000fffffffe RBX: 0000000000000001 RCX: ffff995376f50930
[ 4231.026341] RDX: 0000000000000000 RSI: 000000000000000d RDI: ffff99534a797000
[ 4231.026343] RBP: 0000000103d5c000 R08: 0000000000000000 R09: 0000000000000002
[ 4231.026345] R10: 000134059b20e470 R11: 0000000000000001 R12: 00000000fffffffe
[ 4231.026348] R13: 0000000000000000 R14: ffff995376f50930 R15: 0000000000000002
[ 4231.026350] FS:  00007efcbc752740(0000) GS:ffff99563f300000(0000) knlGS:0000000000000000
[ 4231.026353] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4231.026355] CR2: 0000559c9b8aa000 CR3: 000000012d076000 CR4: 00000000003506e0
[ 4231.026358] Call Trace:
[ 4231.026361]  <TASK>
[ 4231.026366]  ? kmem_cache_free+0x328/0x350
[ 4231.026373]  __btrfs_run_delayed_refs+0x6ea/0xfe0 [btrfs]
[ 4231.026439]  btrfs_run_delayed_refs+0x69/0x1f0 [btrfs]
[ 4231.026499]  btrfs_start_dirty_block_groups+0x2c6/0x590 [btrfs]
[ 4231.026578]  btrfs_commit_transaction+0x7cf/0xb90 [btrfs]
[ 4231.026643]  ? btrfs_attach_transaction_barrier+0x29/0x60 [btrfs]
[ 4231.026706]  ? vfs_fsync_range+0xa0/0xa0
[ 4231.026713]  iterate_supers+0x95/0x110
[ 4231.026718]  ksys_sync+0x60/0xb0
[ 4231.026722]  __do_sys_sync+0xa/0x20
[ 4231.026726]  do_syscall_64+0x3b/0x90
[ 4231.026731]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 4231.026737] RIP: 0033:0x7efcbc858ae7
[ 4231.026742] Code: 0f 1f 00 48 8b 15 39 f3 0e 00 f7 d8 64 89 02 b8 ff ff ff ff eb b0 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 b8 a2 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 09 f3 0e 00 f7 d8 64 89 01 48
[ 4231.026745] RSP: 002b:00007ffeaf8e4388 EFLAGS: 00000206 ORIG_RAX: 00000000000000a2
[ 4231.026749] RAX: ffffffffffffffda RBX: 00007ffeaf8e4578 RCX: 00007efcbc858ae7
[ 4231.026752] RDX: 0000000000000000 RSI: 00007ffeaf8e4578 RDI: 00007efcbc9088de
[ 4231.026754] RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
[ 4231.026756] R10: 00007efcbc76a258 R11: 0000000000000206 R12: 0000000000000000
[ 4231.026758] R13: 0000000000000000 R14: 00007ffeaf8e6076 R15: 00007efcbca50000
[ 4231.026764]  </TASK>
[ 4231.026766] ---[ end trace 0000000000000000 ]---
[ 4231.026771] BTRFS info (device sdb1): leaf 1001034072064 gen 131 total ptrs 140 free space 8163 owner 2
[ 4231.026776] 	item 0 key (4357472256 169 0) itemoff 16250 itemsize 33
[ 4231.026780] 		extent refs 1 gen 1 flags 2
[ 4231.026783] 		ref#0: tree block backref root 2
[ 4231.026786] 	item 1 key (4357488640 169 0) itemoff 16217 itemsize 33
[ 4231.026789] 		extent refs 1 gen 1 flags 2
[ 4231.026791] 		ref#0: tree block backref root 2
[ 4231.026794] 	item 2 key (4357505024 169 0) itemoff 16184 itemsize 33
[ 4231.026797] 		extent refs 1 gen 1 flags 2
[ 4231.026799] 		ref#0: tree block backref root 2
[ 4231.026802] 	item 3 key (4357521408 169 0) itemoff 16151 itemsize 33
[ 4231.026805] 		extent refs 1 gen 1 flags 2
[ 4231.026806] 		ref#0: tree block backref root 2
[ 4231.026809] 	item 4 key (4357537792 169 0) itemoff 16118 itemsize 33
[ 4231.026811] 		extent refs 1 gen 1 flags 2
[ 4231.026813] 		ref#0: tree block backref root 2
[ 4231.026815] 	item 5 key (4357554176 169 0) itemoff 16085 itemsize 33
[ 4231.026818] 		extent refs 1 gen 1 flags 2
[ 4231.026820] 		ref#0: tree block backref root 2
[ 4231.026822] 	item 6 key (4357570560 169 0) itemoff 16052 itemsize 33
[ 4231.026825] 		extent refs 1 gen 1 flags 2
[ 4231.026826] 		ref#0: tree block backref root 2
[ 4231.026829] 	item 7 key (4357586944 169 0) itemoff 16019 itemsize 33
[ 4231.026831] 		extent refs 1 gen 1 flags 2
[ 4231.026833] 		ref#0: tree block backref root 2
[ 4231.026836] 	item 8 key (4357603328 169 0) itemoff 15986 itemsize 33
[ 4231.026838] 		extent refs 1 gen 1 flags 2
[ 4231.026840] 		ref#0: tree block backref root 2
[ 4231.026842] 	item 9 key (4357619712 169 0) itemoff 15953 itemsize 33
[ 4231.026844] 		extent refs 1 gen 1 flags 2
[ 4231.026846] 		ref#0: tree block backref root 2
[ 4231.026849] 	item 10 key (4357636096 169 0) itemoff 15920 itemsize 33
[ 4231.026851] 		extent refs 1 gen 1 flags 2
[ 4231.026853] 		ref#0: tree block backref root 2
[ 4231.026856] 	item 11 key (4357652480 169 0) itemoff 15887 itemsize 33
[ 4231.026858] 		extent refs 1 gen 1 flags 2
[ 4231.026860] 		ref#0: tree block backref root 2
[ 4231.026863] 	item 12 key (4357668864 169 0) itemoff 15854 itemsize 33
[ 4231.026865] 		extent refs 1 gen 1 flags 2
[ 4231.026867] 		ref#0: tree block backref root 2
[ 4231.026870] 	item 13 key (4357685248 169 0) itemoff 15821 itemsize 33
[ 4231.026872] 		extent refs 1 gen 1 flags 2
[ 4231.026874] 		ref#0: tree block backref root 2
[ 4231.026876] 	item 14 key (4357701632 169 0) itemoff 15788 itemsize 33
[ 4231.026879] 		extent refs 1 gen 1 flags 2
[ 4231.026880] 		ref#0: tree block backref root 2
[ 4231.026883] 	item 15 key (4357718016 169 0) itemoff 15755 itemsize 33
[ 4231.026886] 		extent refs 1 gen 1 flags 2
[ 4231.026887] 		ref#0: tree block backref root 2
[ 4231.026890] 	item 16 key (4357734400 169 0) itemoff 15722 itemsize 33
[ 4231.026892] 		extent refs 1 gen 1 flags 2
[ 4231.026894] 		ref#0: tree block backref root 2
[ 4231.026896] 	item 17 key (4357750784 169 0) itemoff 15689 itemsize 33
[ 4231.026898] 		extent refs 1 gen 1 flags 2
[ 4231.026900] 		ref#0: tree block backref root 2
[ 4231.026902] 	item 18 key (4357767168 169 0) itemoff 15656 itemsize 33
[ 4231.026905] 		extent refs 1 gen 1 flags 2
[ 4231.026906] 		ref#0: tree block backref root 2
[ 4231.026909] 	item 19 key (4357783552 169 0) itemoff 15623 itemsize 33
[ 4231.026911] 		extent refs 1 gen 1 flags 2
[ 4231.026913] 		ref#0: tree block backref root 2
[ 4231.026915] 	item 20 key (4357799936 169 0) itemoff 15590 itemsize 33
[ 4231.026918] 		extent refs 1 gen 1 flags 2
[ 4231.026920] 		ref#0: tree block backref root 2
[ 4231.026922] 	item 21 key (4357816320 169 0) itemoff 15557 itemsize 33
[ 4231.026925] 		extent refs 1 gen 1 flags 2
[ 4231.026927] 		ref#0: tree block backref root 2
[ 4231.026929] 	item 22 key (4357832704 169 0) itemoff 15524 itemsize 33
[ 4231.026931] 		extent refs 1 gen 1 flags 2
[ 4231.026933] 		ref#0: tree block backref root 2
[ 4231.026936] 	item 23 key (4357849088 169 0) itemoff 15491 itemsize 33
[ 4231.026938] 		extent refs 1 gen 1 flags 2
[ 4231.026940] 		ref#0: tree block backref root 2
[ 4231.026988] 	item 24 key (4357865472 169 0) itemoff 15458 itemsize 33
[ 4231.026992] 		extent refs 1 gen 1 flags 2
[ 4231.026994] 		ref#0: tree block backref root 2
[ 4231.026996] 	item 25 key (4357881856 169 0) itemoff 15425 itemsize 33
[ 4231.026999] 		extent refs 1 gen 1 flags 2
[ 4231.027001] 		ref#0: tree block backref root 2
[ 4231.027003] 	item 26 key (4357898240 169 0) itemoff 15392 itemsize 33
[ 4231.027005] 		extent refs 1 gen 1 flags 2
[ 4231.027007] 		ref#0: tree block backref root 2
[ 4231.027009] 	item 27 key (4357914624 169 0) itemoff 15359 itemsize 33
[ 4231.027012] 		extent refs 1 gen 1 flags 2
[ 4231.027013] 		ref#0: tree block backref root 2
[ 4231.027016] 	item 28 key (4357931008 169 0) itemoff 15326 itemsize 33
[ 4231.027018] 		extent refs 1 gen 1 flags 2
[ 4231.027020] 		ref#0: tree block backref root 2
[ 4231.027022] 	item 29 key (4357947392 169 0) itemoff 15293 itemsize 33
[ 4231.027025] 		extent refs 1 gen 1 flags 2
[ 4231.027027] 		ref#0: tree block backref root 2
[ 4231.027029] 	item 30 key (4357963776 169 0) itemoff 15260 itemsize 33
[ 4231.027032] 		extent refs 1 gen 1 flags 2
[ 4231.027034] 		ref#0: tree block backref root 2
[ 4231.027036] 	item 31 key (4357980160 169 0) itemoff 15227 itemsize 33
[ 4231.027039] 		extent refs 1 gen 1 flags 2
[ 4231.027041] 		ref#0: tree block backref root 2
[ 4231.027043] 	item 32 key (4357996544 169 0) itemoff 15194 itemsize 33
[ 4231.027046] 		extent refs 1 gen 1 flags 2
[ 4231.027048] 		ref#0: tree block backref root 2
[ 4231.027050] 	item 33 key (4358012928 169 0) itemoff 15161 itemsize 33
[ 4231.027053] 		extent refs 1 gen 1 flags 2
[ 4231.027054] 		ref#0: tree block backref root 2
[ 4231.027057] 	item 34 key (4358029312 169 0) itemoff 15128 itemsize 33
[ 4231.027060] 		extent refs 1 gen 1 flags 2
[ 4231.027061] 		ref#0: tree block backref root 2
[ 4231.027063] 	item 35 key (4358045696 169 0) itemoff 15095 itemsize 33
[ 4231.027066] 		extent refs 1 gen 1 flags 2
[ 4231.027068] 		ref#0: tree block backref root 2
[ 4231.027070] 	item 36 key (4358062080 169 0) itemoff 15062 itemsize 33
[ 4231.027072] 		extent refs 1 gen 1 flags 2
[ 4231.027074] 		ref#0: tree block backref root 2
[ 4231.027076] 	item 37 key (4358078464 169 0) itemoff 15029 itemsize 33
[ 4231.027079] 		extent refs 1 gen 1 flags 2
[ 4231.027081] 		ref#0: tree block backref root 2
[ 4231.027083] 	item 38 key (4358094848 169 0) itemoff 14996 itemsize 33
[ 4231.027086] 		extent refs 1 gen 1 flags 2
[ 4231.027087] 		ref#0: tree block backref root 2
[ 4231.027090] 	item 39 key (4358111232 169 0) itemoff 14963 itemsize 33
[ 4231.027092] 		extent refs 1 gen 1 flags 2
[ 4231.027094] 		ref#0: tree block backref root 2
[ 4231.027097] 	item 40 key (4358127616 169 0) itemoff 14930 itemsize 33
[ 4231.027099] 		extent refs 1 gen 1 flags 2
[ 4231.027101] 		ref#0: tree block backref root 2
[ 4231.027103] 	item 41 key (4358144000 169 0) itemoff 14897 itemsize 33
[ 4231.027106] 		extent refs 1 gen 1 flags 2
[ 4231.027107] 		ref#0: tree block backref root 2
[ 4231.027110] 	item 42 key (4358160384 169 0) itemoff 14864 itemsize 33
[ 4231.027113] 		extent refs 1 gen 1 flags 2
[ 4231.027114] 		ref#0: tree block backref root 2
[ 4231.027117] 	item 43 key (4358176768 169 0) itemoff 14831 itemsize 33
[ 4231.027120] 		extent refs 1 gen 1 flags 2
[ 4231.027121] 		ref#0: tree block backref root 2
[ 4231.027124] 	item 44 key (4358193152 169 0) itemoff 14798 itemsize 33
[ 4231.027127] 		extent refs 1 gen 1 flags 2
[ 4231.027129] 		ref#0: tree block backref root 2
[ 4231.027131] 	item 45 key (4358209536 169 0) itemoff 14765 itemsize 33
[ 4231.027133] 		extent refs 1 gen 1 flags 2
[ 4231.027135] 		ref#0: tree block backref root 2
[ 4231.027137] 	item 46 key (4358225920 169 0) itemoff 14732 itemsize 33
[ 4231.027140] 		extent refs 1 gen 1 flags 2
[ 4231.027141] 		ref#0: tree block backref root 2
[ 4231.027144] 	item 47 key (4358242304 169 0) itemoff 14699 itemsize 33
[ 4231.027146] 		extent refs 1 gen 1 flags 2
[ 4231.027148] 		ref#0: tree block backref root 2
[ 4231.027150] 	item 48 key (4358258688 169 0) itemoff 14666 itemsize 33
[ 4231.027153] 		extent refs 1 gen 1 flags 2
[ 4231.027155] 		ref#0: tree block backref root 2
[ 4231.027157] 	item 49 key (4358275072 169 0) itemoff 14633 itemsize 33
[ 4231.027160] 		extent refs 1 gen 1 flags 2
[ 4231.027162] 		ref#0: tree block backref root 2
[ 4231.027164] 	item 50 key (4358291456 169 0) itemoff 14600 itemsize 33
[ 4231.027166] 		extent refs 1 gen 1 flags 2
[ 4231.027168] 		ref#0: tree block backref root 2
[ 4231.027171] 	item 51 key (4358307840 169 0) itemoff 14567 itemsize 33
[ 4231.027173] 		extent refs 1 gen 1 flags 2
[ 4231.027175] 		ref#0: tree block backref root 2
[ 4231.027178] 	item 52 key (4358324224 169 0) itemoff 14534 itemsize 33
[ 4231.027180] 		extent refs 1 gen 1 flags 2
[ 4231.027182] 		ref#0: tree block backref root 2
[ 4231.027184] 	item 53 key (4358340608 169 0) itemoff 14501 itemsize 33
[ 4231.027187] 		extent refs 1 gen 1 flags 2
[ 4231.027189] 		ref#0: tree block backref root 2
[ 4231.027191] 	item 54 key (4358356992 169 0) itemoff 14468 itemsize 33
[ 4231.027193] 		extent refs 1 gen 1 flags 2
[ 4231.027195] 		ref#0: tree block backref root 2
[ 4231.027197] 	item 55 key (4358373376 169 0) itemoff 14435 itemsize 33
[ 4231.027200] 		extent refs 1 gen 1 flags 2
[ 4231.027201] 		ref#0: tree block backref root 2
[ 4231.027204] 	item 56 key (4358389760 169 0) itemoff 14402 itemsize 33
[ 4231.027206] 		extent refs 1 gen 1 flags 2
[ 4231.027208] 		ref#0: tree block backref root 2
[ 4231.027210] 	item 57 key (4358406144 169 0) itemoff 14369 itemsize 33
[ 4231.027213] 		extent refs 1 gen 1 flags 2
[ 4231.027215] 		ref#0: tree block backref root 2
[ 4231.027217] 	item 58 key (4358422528 169 0) itemoff 14336 itemsize 33
[ 4231.027220] 		extent refs 1 gen 1 flags 2
[ 4231.027221] 		ref#0: tree block backref root 2
[ 4231.027224] 	item 59 key (4358438912 169 0) itemoff 14303 itemsize 33
[ 4231.027227] 		extent refs 1 gen 1 flags 2
[ 4231.027228] 		ref#0: tree block backref root 2
[ 4231.027231] 	item 60 key (4358455296 169 0) itemoff 14270 itemsize 33
[ 4231.027233] 		extent refs 1 gen 1 flags 2
[ 4231.027235] 		ref#0: tree block backref root 2
[ 4231.027237] 	item 61 key (4358471680 169 0) itemoff 14237 itemsize 33
[ 4231.027240] 		extent refs 1 gen 1 flags 2
[ 4231.027241] 		ref#0: tree block backref root 2
[ 4231.027244] 	item 62 key (4358488064 169 0) itemoff 14204 itemsize 33
[ 4231.027247] 		extent refs 1 gen 1 flags 2
[ 4231.027248] 		ref#0: tree block backref root 2
[ 4231.027251] 	item 63 key (4358504448 169 0) itemoff 14171 itemsize 33
[ 4231.027254] 		extent refs 1 gen 1 flags 2
[ 4231.027255] 		ref#0: tree block backref root 2
[ 4231.027258] 	item 64 key (4358520832 169 0) itemoff 14138 itemsize 33
[ 4231.027260] 		extent refs 1 gen 1 flags 2
[ 4231.027262] 		ref#0: tree block backref root 2
[ 4231.027264] 	item 65 key (4358537216 169 0) itemoff 14105 itemsize 33
[ 4231.027267] 		extent refs 1 gen 1 flags 2
[ 4231.027269] 		ref#0: tree block backref root 2
[ 4231.027271] 	item 66 key (4358553600 169 0) itemoff 14072 itemsize 33
[ 4231.027273] 		extent refs 1 gen 1 flags 2
[ 4231.027275] 		ref#0: tree block backref root 2
[ 4231.027277] 	item 67 key (4358569984 169 0) itemoff 14039 itemsize 33
[ 4231.027280] 		extent refs 1 gen 1 flags 2
[ 4231.027281] 		ref#0: tree block backref root 2
[ 4231.027283] 	item 68 key (4358586368 169 0) itemoff 14006 itemsize 33
[ 4231.027286] 		extent refs 1 gen 1 flags 2
[ 4231.027287] 		ref#0: tree block backref root 2
[ 4231.027290] 	item 69 key (4358602752 169 0) itemoff 13973 itemsize 33
[ 4231.027292] 		extent refs 1 gen 1 flags 2
[ 4231.027294] 		ref#0: tree block backref root 2
[ 4231.027296] 	item 70 key (4358619136 169 0) itemoff 13940 itemsize 33
[ 4231.027299] 		extent refs 1 gen 1 flags 2
[ 4231.027301] 		ref#0: tree block backref root 2
[ 4231.027303] 	item 71 key (4358635520 169 0) itemoff 13907 itemsize 33
[ 4231.027306] 		extent refs 1 gen 1 flags 2
[ 4231.027307] 		ref#0: tree block backref root 2
[ 4231.027310] 	item 72 key (4358651904 169 0) itemoff 13874 itemsize 33
[ 4231.027312] 		extent refs 1 gen 1 flags 2
[ 4231.027314] 		ref#0: tree block backref root 2
[ 4231.027317] 	item 73 key (4358668288 169 0) itemoff 13841 itemsize 33
[ 4231.027319] 		extent refs 1 gen 1 flags 2
[ 4231.027321] 		ref#0: tree block backref root 2
[ 4231.027323] 	item 74 key (4358684672 169 0) itemoff 13808 itemsize 33
[ 4231.027326] 		extent refs 1 gen 1 flags 2
[ 4231.027328] 		ref#0: tree block backref root 2
[ 4231.027330] 	item 75 key (4358701056 169 0) itemoff 13775 itemsize 33
[ 4231.027333] 		extent refs 1 gen 1 flags 2
[ 4231.027335] 		ref#0: tree block backref root 2
[ 4231.027337] 	item 76 key (4358717440 169 0) itemoff 13742 itemsize 33
[ 4231.027340] 		extent refs 1 gen 1 flags 2
[ 4231.027342] 		ref#0: tree block backref root 2
[ 4231.027344] 	item 77 key (4358733824 169 0) itemoff 13709 itemsize 33
[ 4231.027347] 		extent refs 1 gen 1 flags 2
[ 4231.027349] 		ref#0: tree block backref root 2
[ 4231.027351] 	item 78 key (4358750208 169 0) itemoff 13676 itemsize 33
[ 4231.027354] 		extent refs 1 gen 1 flags 2
[ 4231.027356] 		ref#0: tree block backref root 2
[ 4231.027358] 	item 79 key (4358766592 169 0) itemoff 13643 itemsize 33
[ 4231.027361] 		extent refs 1 gen 1 flags 2
[ 4231.027363] 		ref#0: tree block backref root 2
[ 4231.027366] 	item 80 key (4358782976 169 0) itemoff 13610 itemsize 33
[ 4231.027368] 		extent refs 1 gen 1 flags 2
[ 4231.027370] 		ref#0: tree block backref root 2
[ 4231.027372] 	item 81 key (4358799360 169 0) itemoff 13577 itemsize 33
[ 4231.027375] 		extent refs 1 gen 1 flags 2
[ 4231.027376] 		ref#0: tree block backref root 2
[ 4231.027379] 	item 82 key (4358815744 169 0) itemoff 13544 itemsize 33
[ 4231.027381] 		extent refs 1 gen 1 flags 2
[ 4231.027383] 		ref#0: tree block backref root 2
[ 4231.027386] 	item 83 key (4358832128 169 0) itemoff 13511 itemsize 33
[ 4231.027388] 		extent refs 1 gen 1 flags 2
[ 4231.027390] 		ref#0: tree block backref root 2
[ 4231.027392] 	item 84 key (4358848512 169 0) itemoff 13478 itemsize 33
[ 4231.027395] 		extent refs 1 gen 1 flags 2
[ 4231.027397] 		ref#0: tree block backref root 2
[ 4231.027399] 	item 85 key (4358864896 169 0) itemoff 13445 itemsize 33
[ 4231.027402] 		extent refs 1 gen 1 flags 2
[ 4231.027404] 		ref#0: tree block backref root 2
[ 4231.027406] 	item 86 key (4358881280 169 0) itemoff 13412 itemsize 33
[ 4231.027409] 		extent refs 1 gen 1 flags 2
[ 4231.027411] 		ref#0: tree block backref root 2
[ 4231.027413] 	item 87 key (4358897664 169 0) itemoff 13379 itemsize 33
[ 4231.027416] 		extent refs 1 gen 1 flags 2
[ 4231.027418] 		ref#0: tree block backref root 2
[ 4231.027420] 	item 88 key (4358914048 169 0) itemoff 13346 itemsize 33
[ 4231.027422] 		extent refs 1 gen 1 flags 2
[ 4231.027424] 		ref#0: tree block backref root 2
[ 4231.027426] 	item 89 key (4358930432 169 0) itemoff 13313 itemsize 33
[ 4231.027429] 		extent refs 1 gen 1 flags 2
[ 4231.027431] 		ref#0: tree block backref root 2
[ 4231.027433] 	item 90 key (4358946816 169 0) itemoff 13280 itemsize 33
[ 4231.027436] 		extent refs 1 gen 1 flags 2
[ 4231.027437] 		ref#0: tree block backref root 2
[ 4231.027440] 	item 91 key (4358963200 169 0) itemoff 13247 itemsize 33
[ 4231.027442] 		extent refs 1 gen 1 flags 2
[ 4231.027444] 		ref#0: tree block backref root 2
[ 4231.027446] 	item 92 key (4358979584 169 0) itemoff 13214 itemsize 33
[ 4231.027448] 		extent refs 1 gen 1 flags 2
[ 4231.027450] 		ref#0: tree block backref root 2
[ 4231.027452] 	item 93 key (4358995968 169 0) itemoff 13181 itemsize 33
[ 4231.027455] 		extent refs 1 gen 1 flags 2
[ 4231.027456] 		ref#0: tree block backref root 2
[ 4231.027459] 	item 94 key (4359012352 169 0) itemoff 13148 itemsize 33
[ 4231.027461] 		extent refs 1 gen 1 flags 2
[ 4231.027463] 		ref#0: tree block backref root 2
[ 4231.027466] 	item 95 key (4359028736 169 0) itemoff 13115 itemsize 33
[ 4231.027468] 		extent refs 1 gen 1 flags 2
[ 4231.027470] 		ref#0: tree block backref root 2
[ 4231.027472] 	item 96 key (4359045120 169 0) itemoff 13082 itemsize 33
[ 4231.027475] 		extent refs 1 gen 1 flags 2
[ 4231.027477] 		ref#0: tree block backref root 2
[ 4231.027479] 	item 97 key (4359061504 169 0) itemoff 13049 itemsize 33
[ 4231.027482] 		extent refs 1 gen 1 flags 2
[ 4231.027484] 		ref#0: tree block backref root 2
[ 4231.027486] 	item 98 key (4359077888 169 0) itemoff 13016 itemsize 33
[ 4231.027489] 		extent refs 1 gen 1 flags 2
[ 4231.027491] 		ref#0: tree block backref root 2
[ 4231.027493] 	item 99 key (4359094272 169 0) itemoff 12983 itemsize 33
[ 4231.027496] 		extent refs 1 gen 1 flags 2
[ 4231.027497] 		ref#0: tree block backref root 2
[ 4231.027500] 	item 100 key (4359110656 169 0) itemoff 12950 itemsize 33
[ 4231.027503] 		extent refs 1 gen 1 flags 2
[ 4231.027505] 		ref#0: tree block backref root 2
[ 4231.027507] 	item 101 key (4359127040 169 0) itemoff 12917 itemsize 33
[ 4231.027509] 		extent refs 1 gen 1 flags 2
[ 4231.027511] 		ref#0: tree block backref root 2
[ 4231.027513] 	item 102 key (4359143424 169 0) itemoff 12884 itemsize 33
[ 4231.027516] 		extent refs 1 gen 1 flags 2
[ 4231.027518] 		ref#0: tree block backref root 2
[ 4231.027522] 	item 103 key (4359159808 169 0) itemoff 12851 itemsize 33
[ 4231.027527] 		extent refs 1 gen 1 flags 2
[ 4231.027529] 		ref#0: tree block backref root 2
[ 4231.027531] 	item 104 key (4359176192 169 0) itemoff 12818 itemsize 33
[ 4231.027534] 		extent refs 1 gen 1 flags 2
[ 4231.027535] 		ref#0: tree block backref root 2
[ 4231.027538] 	item 105 key (4359192576 169 0) itemoff 12785 itemsize 33
[ 4231.027541] 		extent refs 1 gen 1 flags 2
[ 4231.027542] 		ref#0: tree block backref root 2
[ 4231.027545] 	item 106 key (4359208960 169 0) itemoff 12752 itemsize 33
[ 4231.027547] 		extent refs 1 gen 1 flags 2
[ 4231.027549] 		ref#0: tree block backref root 2
[ 4231.027551] 	item 107 key (4359225344 169 1) itemoff 12719 itemsize 33
[ 4231.027554] 		extent refs 1 gen 1 flags 2
[ 4231.027556] 		ref#0: tree block backref root 2
[ 4231.027558] 	item 108 key (4359241728 169 1) itemoff 12686 itemsize 33
[ 4231.027561] 		extent refs 1 gen 1 flags 2
[ 4231.027563] 		ref#0: tree block backref root 2
[ 4231.027565] 	item 109 key (4359258112 169 1) itemoff 12653 itemsize 33
[ 4231.027568] 		extent refs 1 gen 1 flags 2
[ 4231.027569] 		ref#0: tree block backref root 2
[ 4231.027572] 	item 110 key (4359274496 169 1) itemoff 12620 itemsize 33
[ 4231.027574] 		extent refs 1 gen 1 flags 2
[ 4231.027576] 		ref#0: tree block backref root 2
[ 4231.027578] 	item 111 key (4359290880 169 1) itemoff 12587 itemsize 33
[ 4231.027581] 		extent refs 1 gen 1 flags 2
[ 4231.027583] 		ref#0: tree block backref root 2
[ 4231.027585] 	item 112 key (4359307264 169 2) itemoff 12554 itemsize 33
[ 4231.027588] 		extent refs 1 gen 1 flags 2
[ 4231.027590] 		ref#0: tree block backref root 2
[ 4231.027592] 	item 113 key (4359323648 169 0) itemoff 12521 itemsize 33
[ 4231.027595] 		extent refs 1 gen 84 flags 2
[ 4231.027597] 		ref#0: tree block backref root 5
[ 4231.027599] 	item 114 key (4359340032 169 0) itemoff 12488 itemsize 33
[ 4231.027602] 		extent refs 1 gen 1 flags 2
[ 4231.027604] 		ref#0: tree block backref root 4
[ 4231.027606] 	item 115 key (4359356416 169 0) itemoff 12455 itemsize 33
[ 4231.027609] 		extent refs 1 gen 84 flags 2
[ 4231.027611] 		ref#0: tree block backref root 5
[ 4231.027613] 	item 116 key (4359372800 169 0) itemoff 12422 itemsize 33
[ 4231.027616] 		extent refs 1 gen 84 flags 2
[ 4231.027617] 		ref#0: tree block backref root 5
[ 4231.027620] 	item 117 key (4359389184 169 0) itemoff 12389 itemsize 33
[ 4231.027622] 		extent refs 1 gen 1 flags 2
[ 4231.027624] 		ref#0: tree block backref root 4
[ 4231.027626] 	item 118 key (4359405568 169 0) itemoff 12356 itemsize 33
[ 4231.027629] 		extent refs 1 gen 1 flags 2
[ 4231.027631] 		ref#0: tree block backref root 4
[ 4231.027633] 	item 119 key (4359421952 169 0) itemoff 12323 itemsize 33
[ 4231.027636] 		extent refs 1 gen 84 flags 2
[ 4231.027637] 		ref#0: tree block backref root 5
[ 4231.027640] 	item 120 key (4359438336 169 0) itemoff 12290 itemsize 33
[ 4231.027643] 		extent refs 1 gen 1 flags 2
[ 4231.027644] 		ref#0: tree block backref root 4
[ 4231.027646] 	item 121 key (4359454720 169 0) itemoff 12257 itemsize 33
[ 4231.027649] 		extent refs 1 gen 84 flags 2
[ 4231.027651] 		ref#0: tree block backref root 5
[ 4231.027653] 	item 122 key (4359471104 169 0) itemoff 12224 itemsize 33
[ 4231.027656] 		extent refs 1 gen 1 flags 2
[ 4231.027658] 		ref#0: tree block backref root 4
[ 4231.027660] 	item 123 key (4359487488 169 0) itemoff 12191 itemsize 33
[ 4231.027663] 		extent refs 1 gen 1 flags 2
[ 4231.027665] 		ref#0: tree block backref root 4
[ 4231.027667] 	item 124 key (4359503872 169 0) itemoff 12158 itemsize 33
[ 4231.027669] 		extent refs 1 gen 1 flags 2
[ 4231.027671] 		ref#0: tree block backref root 4
[ 4231.027674] 	item 125 key (4359520256 169 0) itemoff 12125 itemsize 33
[ 4231.027676] 		extent refs 1 gen 1 flags 2
[ 4231.027678] 		ref#0: tree block backref root 4
[ 4231.027680] 	item 126 key (4359536640 169 0) itemoff 12092 itemsize 33
[ 4231.027683] 		extent refs 1 gen 1 flags 2
[ 4231.027685] 		ref#0: tree block backref root 4
[ 4231.027687] 	item 127 key (4359553024 169 0) itemoff 12059 itemsize 33
[ 4231.027689] 		extent refs 1 gen 1 flags 2
[ 4231.027691] 		ref#0: tree block backref root 4
[ 4231.027694] 	item 128 key (4359569408 169 0) itemoff 12026 itemsize 33
[ 4231.027696] 		extent refs 1 gen 1 flags 2
[ 4231.027698] 		ref#0: tree block backref root 4
[ 4231.027701] 	item 129 key (4359585792 169 0) itemoff 11993 itemsize 33
[ 4231.027703] 		extent refs 1 gen 1 flags 2
[ 4231.027705] 		ref#0: tree block backref root 4
[ 4231.027708] 	item 130 key (4359602176 169 0) itemoff 11960 itemsize 33
[ 4231.027710] 		extent refs 1 gen 1 flags 2
[ 4231.027712] 		ref#0: tree block backref root 4
[ 4231.027714] 	item 131 key (4359618560 169 0) itemoff 11927 itemsize 33
[ 4231.027717] 		extent refs 1 gen 1 flags 2
[ 4231.027719] 		ref#0: tree block backref root 4
[ 4231.027721] 	item 132 key (4359634944 169 0) itemoff 11894 itemsize 33
[ 4231.027724] 		extent refs 1 gen 1 flags 2
[ 4231.027725] 		ref#0: tree block backref root 4
[ 4231.027728] 	item 133 key (4359651328 169 0) itemoff 11861 itemsize 33
[ 4231.027730] 		extent refs 1 gen 1 flags 2
[ 4231.027732] 		ref#0: tree block backref root 4
[ 4231.027734] 	item 134 key (4359667712 169 0) itemoff 11828 itemsize 33
[ 4231.027737] 		extent refs 1 gen 1 flags 2
[ 4231.027739] 		ref#0: tree block backref root 4
[ 4231.027741] 	item 135 key (4359684096 169 0) itemoff 11795 itemsize 33
[ 4231.027744] 		extent refs 1 gen 1 flags 2
[ 4231.027746] 		ref#0: tree block backref root 4
[ 4231.027748] 	item 136 key (4359700480 169 0) itemoff 11762 itemsize 33
[ 4231.027751] 		extent refs 1 gen 1 flags 2
[ 4231.027753] 		ref#0: tree block backref root 4
[ 4231.027755] 	item 137 key (4359716864 169 0) itemoff 11729 itemsize 33
[ 4231.027758] 		extent refs 1 gen 1 flags 2
[ 4231.027760] 		ref#0: tree block backref root 4
[ 4231.027762] 	item 138 key (4359733248 169 0) itemoff 11696 itemsize 33
[ 4231.027764] 		extent refs 1 gen 1 flags 2
[ 4231.027766] 		ref#0: tree block backref root 4
[ 4231.027769] 	item 139 key (4359749632 169 0) itemoff 11663 itemsize 33
[ 4231.027771] 		extent refs 1 gen 84 flags 2
[ 4231.027773] 		ref#0: tree block backref root 5
[ 4231.027777] BTRFS error (device sdb1): unable to find ref byte nr 4359307264 parent 0 root 2  owner 0 offset 0
[ 4231.027785] ------------[ cut here ]------------
[ 4231.027787] BTRFS: Transaction aborted (error -2)
[ 4231.027829] WARNING: CPU: 4 PID: 30119 at fs/btrfs/extent-tree.c:3079 __btrfs_free_extent+0x786/0xa50 [btrfs]
[ 4231.027892] Modules linked in: rfcomm bnep iwlmvm mac80211 libarc4 snd_ctl_led snd_hda_codec_conexant kvm_amd iwlwifi wmi_bmof snd_hda_codec_generic uvcvideo kvm snd_hda_codec_hdmi videobuf2_vmalloc videobuf2_memops snd_hda_intel btusb videobuf2_v4l2 snd_intel_dspcfg btrtl snd_hda_codec btintel irqbypass videobuf2_common bluetooth tpm_crb snd_hwdep cfg80211 snd_hda_core snd_pcm i2c_piix4 wmi tpm_tis tpm_tis_core i2c_scmi fuse amdgpu drm_ttm_helper ttm mfd_core iommu_v2 crc32_pclmul ucsi_acpi uas gpu_sched sdhci_pci drm_display_helper thinkpad_acpi typec_ucsi usb_storage iosf_mbi ccp typec cec cqhci platform_profile btrfs xor raid6_pq zstd_compress
[ 4231.027986] CPU: 4 PID: 30119 Comm: sync Tainted: G        W       T 5.19.12-gentoo #1
[ 4231.027990] Hardware name: LENOVO 20KUCTO1WW/20KUCTO1WW, BIOS R0UET82W (1.62 ) 08/11/2022
[ 4231.027992] RIP: 0010:__btrfs_free_extent+0x786/0xa50 [btrfs]
[ 4231.028052] Code: 40 50 48 89 44 24 18 48 05 58 0a 00 00 f0 48 0f ba 28 03 0f 82 25 7f 0c 00 be fe ff ff ff 48 c7 c7 20 2f 67 c0 e8 86 22 68 e3 <0f> 0b e9 0d 7f 0c 00 ff c8 be 19 00 00 00 49 8b 3e 41 89 46 40 48
[ 4231.028055] RSP: 0018:ffffb3084b537bc0 EFLAGS: 00010282
[ 4231.028059] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000027
[ 4231.028062] RDX: ffff99563f31f528 RSI: 0000000000000001 RDI: ffff99563f31f520
[ 4231.028064] RBP: 0000000103d5c000 R08: 0000000000000000 R09: ffffffffa48456e0
[ 4231.028066] R10: 0000000000000001 R11: 0000000000000001 R12: 00000000fffffffe
[ 4231.028069] R13: 0000000000000000 R14: ffff995376f50930 R15: 0000000000000002
[ 4231.028071] FS:  00007efcbc752740(0000) GS:ffff99563f300000(0000) knlGS:0000000000000000
[ 4231.028074] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4231.028076] CR2: 0000559c9b8aa000 CR3: 000000012d076000 CR4: 00000000003506e0
[ 4231.028079] Call Trace:
[ 4231.028083]  <TASK>
[ 4231.028087]  ? kmem_cache_free+0x328/0x350
[ 4231.028094]  __btrfs_run_delayed_refs+0x6ea/0xfe0 [btrfs]
[ 4231.028159]  btrfs_run_delayed_refs+0x69/0x1f0 [btrfs]
[ 4231.028221]  btrfs_start_dirty_block_groups+0x2c6/0x590 [btrfs]
[ 4231.028299]  btrfs_commit_transaction+0x7cf/0xb90 [btrfs]
[ 4231.028361]  ? btrfs_attach_transaction_barrier+0x29/0x60 [btrfs]
[ 4231.028424]  ? vfs_fsync_range+0xa0/0xa0
[ 4231.028430]  iterate_supers+0x95/0x110
[ 4231.028435]  ksys_sync+0x60/0xb0
[ 4231.028439]  __do_sys_sync+0xa/0x20
[ 4231.028443]  do_syscall_64+0x3b/0x90
[ 4231.028448]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 4231.028454] RIP: 0033:0x7efcbc858ae7
[ 4231.028459] Code: 0f 1f 00 48 8b 15 39 f3 0e 00 f7 d8 64 89 02 b8 ff ff ff ff eb b0 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 b8 a2 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 09 f3 0e 00 f7 d8 64 89 01 48
[ 4231.028461] RSP: 002b:00007ffeaf8e4388 EFLAGS: 00000206 ORIG_RAX: 00000000000000a2
[ 4231.028466] RAX: ffffffffffffffda RBX: 00007ffeaf8e4578 RCX: 00007efcbc858ae7
[ 4231.028468] RDX: 0000000000000000 RSI: 00007ffeaf8e4578 RDI: 00007efcbc9088de
[ 4231.028470] RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
[ 4231.028472] R10: 00007efcbc76a258 R11: 0000000000000206 R12: 0000000000000000
[ 4231.028474] R13: 0000000000000000 R14: 00007ffeaf8e6076 R15: 00007efcbca50000
[ 4231.028479]  </TASK>
[ 4231.028480] ---[ end trace 0000000000000000 ]---
[ 4231.028484] BTRFS: error (device sdb1: state A) in __btrfs_free_extent:3079: errno=-2 No such entry
[ 4231.028492] BTRFS info (device sdb1: state EA): forced readonly
[ 4231.028499] BTRFS: error (device sdb1: state EA) in btrfs_run_delayed_refs:2157: errno=-2 No such entry

simple btrfs check doesn't report any problems. I was trying to chown -R the entire disk (~700GB /1TB), and it would always resulted in the above warning and the drive switching to RO mode.
I was able to complete chown by running it on individual directories followed by sync and unmount/remount when the drive switched to RO, so there wasn't a single affected file/directory that would trigger the error.

I'm currently running btrfs check --init-extent-tree. it has been running for about an hour reporting tons of messages like the following:

ref mismatch on [2058043392 16384] extent item 0, found 1
tree backref 2058043392 root 5 not found in extent tree
backpointer mismatch on [2058043392 16384]
adding new tree backref on start 2058043392 len 16384 parent 0 root 5
Repaired extent references for 2058043392

This is all done using gentoo kernel 5.19.12 (mostly identical to upstream 5.19.12)

@maharmstone
Copy link
Owner

simple btrfs check doesn't report any problems

What version of btrfs-progs do you have installed? If not the latest (5.18.1?), does the latest also report no errors?

@jvesely
Copy link

jvesely commented Oct 2, 2022

simple btrfs check doesn't report any problems

What version of btrfs-progs do you have installed? If not the latest (5.18.1?), does the latest also report no errors?

$ btrfs --version
btrfs-progs v5.15.1

I'll update to 5.19.1 and check again, but the currently running check --init-extent-tree will probably affect things. I'm not sure I can interrupt the running repair job.

EDIT: I interrupted (Ctrl+C) the repair job and updated btrfs-progs to 5.19.1. now even simple btrfs check /dev/sdb1 reports:

[1/7] checking root items
Error: could not find extent items for root 256
ERROR: failed to repair root items: No such file or directory

and tons of reports like:

ref mismatch on [1011768557568 16384] extent item 0, found 1
tree backref 1011768557568 root 3 not found in extent tree
backpointer mismatch on [1011768557568 16384]

@Radiicall
Copy link

These issues are still occuring on btrfs-progs v6.0.2, I'm on Fedora 37 and i compiled ntfs2btrfs from source. Running the command btrfs check --init-extent-tree seems to have found the issues and is fixing them currently (hopefully).

@heyzec
Copy link

heyzec commented Feb 19, 2023

Same here on btrfs-progs v6.1.3. btrfs check did not detect any issues. btrfs check --init-extent-tree and btrfs check --repair does not make any difference. I think it is best to have a warning to backup the filesystem before trying this out. Thankfully, I did have one and just had to format the partition and restore.

@javaarchive
Copy link

I encountered the same issue today, I was doing sudo chown -R myuser:myuser . before it went read only.

@sleirsgoevy
Copy link

Steps to reproduce without Steam:

dd if=/dev/null of=test.img bs=1048576 seek=4096
dd if=/dev/urandom of=test.blob bs=1024 count=1
mkfs.ntfs -F test.img
mkdir mnt
mount test.img ./mnt # with ntfs-3g
for i in `seq 1 1000`; do cp test.blob ./mnt/test$i.blob; done
umount ./mnt
ntfs2btrfs -d test.img
mount test.img ./mnt # with btrfs
rm ./mnt/*.blob # tons of EROFS errors

@maharmstone
Copy link
Owner

@sleirsgoevy - Yes, thank you, that works for me.

BTRFS error (device loop10): unable to find ref byte nr 538476544 parent 0 root 5  owner 321 offset 0
...
Call Trace:
 <TASK>
 ? btrfs_block_rsv_release+0xae/0x1b0
 __btrfs_run_delayed_refs+0x2b5/0x11e0
 btrfs_run_delayed_refs+0x70/0x1e0
 flush_space+0x32b/0x590
 ? btrfs_get_alloc_profile+0xb4/0x190
 btrfs_preempt_reclaim_metadata_space+0x92/0x1b0
 process_one_work+0x1db/0x3d0
 worker_thread+0x45/0x3c0
 ? rescuer_thread+0x3a0/0x3a0
 kthread+0xd2/0x100
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x1f/0x30
 </TASK>

@maharmstone
Copy link
Owner

I'll have to have a proper look, but I can't see that ntfs2btrfs is doing anything obviously wrong:

Tree 2:
 20188000,a8,1000
 extent_item_key refcount=2 gen=1 flags=1
 extent_data_ref root=100 objid=101 offset=20088000 count=1
 extent_data_ref root=5 objid=141 offset=0 count=1 
 
Tree 5:
 141,6c,0
 extent_data gen=1 size=1000 comp=0 enc=0 otherenc=0 type=1 ea=20188000 es=1000 o=0 s=1000
 
Tree 100:
 101,6c,20088000
 extent_data gen=1 size=1000 comp=0 enc=0 otherenc=0 type=1 ea=20188000 es=1000 o=0 s=1000

@maharmstone
Copy link
Owner

Thanks everybody for this - I've released a new version today which fixes these problems. There were actually two issues, neither of which was picked up by btrfs check, but I'm going to submit patches to btrfs-progs to rectify that.

maharmstone added a commit to maharmstone/btrfs-progs that referenced this issue May 1, 2023
The kernel seems to order inline extent items in a particular way:
forward by sub-type, then reverse by hash. Having these out of order can
cause a volume to go readonly when deleting an inode.

See maharmstone/ntfs2btrfs#51

Signed-off-by: Mark Harmstone <[email protected]>
maharmstone added a commit to maharmstone/btrfs-progs that referenced this issue May 1, 2023
For a skinny metadata item in the extent tree, the key offset represents
the level of the tree it points to. This adds a check that these values
match, as otherwise it can cause a volume to go readonly when deleting a
large number of inodes.

See maharmstone/ntfs2btrfs#51

Signed-off-by: Mark Harmstone <[email protected]>
@Redemption198
Copy link

Thanks everybody for this - I've released a new version today which fixes these problems. There were actually two issues, neither of which was picked up by btrfs check, but I'm going to submit patches to btrfs-progs to rectify that.

Thank you, I've reconverted my ntfs drive into btrfs with 20230501 and it is working perfectly.

kdave pushed a commit to kdave/btrfs-progs that referenced this issue Sep 5, 2023
For a skinny metadata item in the extent tree, the key offset represents
the level of the tree it points to. This adds a check that these values
match, as otherwise it can cause a volume to go readonly when deleting a
large number of inodes.

See maharmstone/ntfs2btrfs#51

Pull-request: #623
Reviewed-by: Qu Wenruo <[email protected]>
Signed-off-by: Mark Harmstone <[email protected]>
Signed-off-by: David Sterba <[email protected]>
kdave pushed a commit to kdave/btrfs-progs that referenced this issue Sep 5, 2023
For a skinny metadata item in the extent tree, the key offset represents
the level of the tree it points to. This adds a check that these values
match, as otherwise it can cause a volume to go readonly when deleting a
large number of inodes.

See maharmstone/ntfs2btrfs#51

Pull-request: #623
Reviewed-by: Qu Wenruo <[email protected]>
Signed-off-by: Mark Harmstone <[email protected]>
Signed-off-by: David Sterba <[email protected]>
kdave pushed a commit to kdave/btrfs-progs that referenced this issue Sep 12, 2023
For a skinny metadata item in the extent tree, the key offset represents
the level of the tree it points to. This adds a check that these values
match, as otherwise it can cause a volume to go readonly when deleting a
large number of inodes.

See maharmstone/ntfs2btrfs#51

Pull-request: #623
Reviewed-by: Qu Wenruo <[email protected]>
Signed-off-by: Mark Harmstone <[email protected]>
Signed-off-by: David Sterba <[email protected]>
kdave pushed a commit to kdave/btrfs-progs that referenced this issue Sep 12, 2023
For a skinny metadata item in the extent tree, the key offset represents
the level of the tree it points to. This adds a check that these values
match, as otherwise it can cause a volume to go readonly when deleting a
large number of inodes.

See maharmstone/ntfs2btrfs#51

Pull-request: #623
Reviewed-by: Qu Wenruo <[email protected]>
Signed-off-by: Mark Harmstone <[email protected]>
Signed-off-by: David Sterba <[email protected]>
kdave pushed a commit to kdave/btrfs-progs that referenced this issue Oct 19, 2023
The kernel seems to order inline extent items in a particular way:
forward by sub-type, then reverse by hash. Having these out of order can
cause a volume to go readonly when deleting an inode.

See maharmstone/ntfs2btrfs#51

With additional comments from the pull request:

 - lookup_inline_extent_backref() is skipping the remaining backref item
   if data/metadata item is smaller (either through the data hash, or
   metadata parent/ref_root) than the target range

 - the fix could be still missing in lowmem mode

 - image could be created according this comment
   maharmstone/ntfs2btrfs#51 (comment)

Pull-request: #622
Signed-off-by: Mark Harmstone <[email protected]>
Signed-off-by: David Sterba <[email protected]>
kdave pushed a commit to kdave/btrfs-progs that referenced this issue Oct 19, 2023
The kernel seems to order inline extent items in a particular way:
forward by sub-type, then reverse by hash. Having these out of order can
cause a volume to go readonly when deleting an inode.

See maharmstone/ntfs2btrfs#51

With additional comments from the pull request:

 - lookup_inline_extent_backref() is skipping the remaining backref item
   if data/metadata item is smaller (either through the data hash, or
   metadata parent/ref_root) than the target range

 - the fix could be still missing in lowmem mode

 - image could be created according this comment
   maharmstone/ntfs2btrfs#51 (comment)

 - due to late merge, the squota newly added key
   BTRFS_EXTENT_OWNER_REF_KEY was not part of the patch and the value of
   'hash' needs to be verified

Pull-request: #622
Signed-off-by: Mark Harmstone <[email protected]>
Signed-off-by: David Sterba <[email protected]>
kdave pushed a commit to kdave/btrfs-progs that referenced this issue Oct 19, 2023
The kernel seems to order inline extent items in a particular way:
forward by sub-type, then reverse by hash. Having these out of order can
cause a volume to go readonly when deleting an inode.

See maharmstone/ntfs2btrfs#51

With additional comments from the pull request:

 - lookup_inline_extent_backref() is skipping the remaining backref item
   if data/metadata item is smaller (either through the data hash, or
   metadata parent/ref_root) than the target range

 - the fix could be still missing in lowmem mode

 - image could be created according this comment
   maharmstone/ntfs2btrfs#51 (comment)

 - due to late merge, the squota newly added key
   BTRFS_EXTENT_OWNER_REF_KEY was not part of the patch and the value of
   'hash' needs to be verified

Pull-request: #622
Signed-off-by: Mark Harmstone <[email protected]>
Signed-off-by: David Sterba <[email protected]>
kdave pushed a commit to kdave/btrfs-progs that referenced this issue Oct 21, 2023
The kernel seems to order inline extent items in a particular way:
forward by sub-type, then reverse by hash. Having these out of order can
cause a volume to go readonly when deleting an inode.

See maharmstone/ntfs2btrfs#51

With additional comments from the pull request:

 - lookup_inline_extent_backref() is skipping the remaining backref item
   if data/metadata item is smaller (either through the data hash, or
   metadata parent/ref_root) than the target range

 - the fix could be still missing in lowmem mode

 - image could be created according this comment
   maharmstone/ntfs2btrfs#51 (comment)

 - due to late merge, the squota newly added key
   BTRFS_EXTENT_OWNER_REF_KEY was not part of the patch and the value of
   'hash' needs to be verified

Pull-request: #622
Signed-off-by: Mark Harmstone <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants