From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=174.142.148.226 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796114883; b=xmR0Dw6v+Nvy/peXMe6AbTjoz/WwXle9CcXbBikCZ+wqJY0z7zTbyU51sbWdA3av5af4 ylYgwXIF2pVv88xgx5O50nhqiOKmFSVo6I1VkF73CPaQbC8O1p8LHwUkkbqDi/z6bb8Uc wBKF+h+73vxP5kQbXXe1AJi8qb95U+vVFQHrjN7pqhbph7bmyboUWgCwa1inmFWx9s+YO cV2zWnKs2FwStqZUz/wfeaKqjDTeNnNdeUhuqESSl3OKZNMuv3nyqDv27vTctw6tw3Qzx tmEKX4VsRLvJKtZr8ChnBVFaGbLYF6yI428xzXSEQ3fkGqJct8pQEihjOkKChQGczhA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796114883; h=DMARC-Filter:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=QquhkocghubAAdTbL+YoA9yAQgqRxynwpmLvf+aw+oo=; b=e771ZTt0b432pz/RYA3v4/guVc1JP+BEcOJ+bZ59PrERiT17CoZnBII+a/QpPcTRuCpo DLBiR6q8SKEImg6joa+vdPu48vSk2EcftGU1QXfehy4XWwHn+DEPlUYSrQZOgu00SfYuh fuuzdOfBljdT92xPM4YkuMZX0lnuAphFg2gFfIpeYQ+0fylK6lnldhoTOmHpuCjL4CNH7 tBHz7MY8UIk3tiZen+1EVDReM22NR47yVTa5EulxReMFeyYPOGaKX3X4IlITdHMpab6B9 AbS50J8OgqtsYQ2n1xCa0CBLGcJS1XsGP0llbo0ZbNRZDhkfW9iqH9TOLU1wp7c6W6w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=furryterror.org; spf=pass smtp.mailfrom=furryterror.org; arc=none smtp.remote-ip=174.142.148.226 Received: from drax.kayaks.hungrycats.org (drax.kayaks.hungrycats.org [174.142.148.226]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C85A4606A31A for ; Tue, 1 Dec 2026 08:48:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C85A4606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=furryterror.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=furryterror.org Received: by drax.kayaks.hungrycats.org (Postfix, from userid 1002) id A25F41D25BEA; Tue, 01 Dec 2026 03:47:56 -0500 (EST) Date: Tue, 1 Dec 2026 03:47:56 -0500 From: Zygo Blaxell To: J Cc: "linux-btrfs@vger.kernel.org" Subject: Re: ENOSPC and unable to add a device to rectify Message-ID: References: X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: On Mon, Nov 30, 2026 at 03:23:04AM +0000, J wrote: > 2026.11.29 @ 17:05:42 > From: https://superuser.com/questions/1419067/btrfs-root-no-space-left-on= -device-auto-remount-read-only-cant-balance-cant > So I ran: >=20 > mount -L "Titan A.E." -o subvol=3D@,noatime,nodev,nosuid,compress=3Dzstd,= space_cache=3Dv2,rw,clear_cache,skip_balance You don't want clear_cache here (or ever, if you're already on space_cache v2). This is not the use case clear_cache is for. clear_cache seems to have bitrotted in v6.14, and can now corrupt filesystems. Try `btrfs check --readonly` to see if your filesystem survived. Run btrfs check with the filesystem unmounted. If you're lucky, the metadata damage we're seeing in the logs didn't get written to disk. Don't mount it read-write again before the btrfs check. A successful mount doesn't mean it's undamaged. To copy data off, use `-o ro,rescue=3Dnologreplay` (a plain ro mount still replays the log tree, which writes), or `ro,rescue=3Dall` if that fails (`ro,rescue=3Dall,rescue=3Dusebackuproot_0` on kernel 7.4-rc to avoid a different regression there). The bug: * While the cache rebuild runs, btrfs_run_delayed_refs() returns immediately without doing anything (BTRFS_FS_CREATING_FREE_SPACE_TREE is set). * Since 882af9f13e83 (v6.14), the rebuild can release its transaction handle between block groups, so another thread can commit partway through. * That commit writes the superblock without applying its extent tree updates. New tree blocks get no extent item, so they look free and get reused. * The rebuild also never clears FREE_SPACE_TREE_VALID, so if it is interrupted, the next mount trusts a partial tree. The commit message of 882af9f13e83 assumes the opposite. The damage needs a transaction commit during the rebuild. Commits happen every 30 seconds by default, so a rebuild running longer than that should be enough, and yours was still going at 47 seconds. I reproduced it on a test VM (7.3 with local patches) by forcing commits with commit=3D1: about 1.5 seconds into the rebuild the warning fired, the mount failed, and btrfs check found extent tree errors. A later plain read-write mount of a copy succeeded, but aborted on the first write after. The log messages that fit: * the 18:47:08 !xa_empty(head_refs) warning comes from the transaction kthread during the rebuild, and no abort is flagged. The teardown dump also shows leftover delayed ref reservations. * the first transid errors (18:46:25) come before that warning, so the damage probably started in the earlier clear_cache mount, whose log wasn't sent. The 18:46 mount then reused those blocks and dropped more updates. * the "missing free space info" warnings probably come from a partial tree. The log pasted here has no "failed to rebuild" line, so we can't see which rebuild was interrupted. > and it looks like it failed on that too with ENOSPC. Maybe. You didn't post a log from that mount, so can't confirm. It's likely you had a normal metadata ENOSPC before you used clear_cache, which would have been recoverable in most cases. Now you have a different problem. > It does happen to be on luks with FDE (The entire disks are encrypted > - ie no partition tables) (dm0-dm3) - and then btrfs device add was > used with dm0/dm1/dm2/dm3. =A0Would this cause space to be estimated > wrong? =A0The journalctl entry mentions: has XXXXXXXXXXXXXXXXXXX free, > is full a number of times. =A0Thus my question. > What is the fix for this? For the original ENOSPC, the usual fix is to delete one file at a time, with sync after each one, until you have enough metadata space free to run a data balance (btrfs balance start -dusage=3D50), at which point you'll have some unallocated space to expand metadata. If it fails with a large file, try smaller ones. You can also add more drives, but it's tricky to pull that off when you have 0.6% of allocated metadata space free. > I grabbed another drive and formatted it via cryptsetup and I'm ready > to add the the array so I ran: >=20 > mount -L "Titan A.E." -o subvol=3D@,noatime,nodev,nosuid,compress=3Dzstd,= space_cache=3Dv2,rw,clear_cache,skip_balance >=20 > again and now I'm getting this: >=20 > Nov 29 18:42:19 kernel: BTRFS info (device dm-3): last unmount of filesys= tem a6b3e68c-c168-4ebd-8f23-a423ce2682b7 > Nov 29 18:46:20 kernel: BTRFS info (device dm-3): first mount of filesyst= em a6b3e68c-c168-4ebd-8f23-a423ce2682b7 > Nov 29 18:46:20 kernel: BTRFS info (device dm-3): using sha256 checksum a= lgorithm > Nov 29 18:46:21 kernel: BTRFS info (device dm-3): rebuilding free space t= ree > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 30998528 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 31850496 mirror 0 wanted 84016 found 84022 This is no longer ENOSPC. It's potential metadata damage. > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 32735232 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 34668544 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 34947072 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 35618816 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 35733504 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 35848192 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 36110336 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:25 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 37371904 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:30 kernel: btrfs_buffer_uptodate: 25 callbacks suppressed > Nov 29 18:46:30 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 94470144 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:30 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 94486528 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:30 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 94584832 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:30 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 94748672 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:30 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 93093888 mirror 0 wanted 84016 found 84022 > Nov 29 18:46:30 kernel: BTRFS error (device dm-3): parent transid verify = failed on logical 93126656 mirror 0 wanted 84016 found 84022 > Nov 29 18:47:08 kernel: ------------[ cut here ]------------ > Nov 29 18:47:08 kernel: !xa_empty(&transaction->delayed_refs.head_refs) > Nov 29 18:47:08 kernel: WARNING: fs/btrfs/transaction.c:174 at btrfs_put_= transaction+0x13c/0x190, CPU#25: btrfs-transacti/3148200 > Nov 29 18:47:08 kernel: Modules linked in: tcp_diag inet_diag uhid snd_se= q_dummy snd_hrtimer snd_seq snd_seq_device veth nf_conntrack_netlink nft_na= t nft_masq nft_ct xfrm_user xfrm_algo nft_fib_ipv4 nft_fib nft_chain_nat nf= _nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables pppoe rfcomm pppo= x algif_hash algif_skcipher ppp_generic slhc af_alg bnep overlay dm_crypt e= ncrypted_keys trusted tee asn1_encoder vfat fat 8021q mrp garp snd_hda_code= c_alc882 snd_hda_codec_realtek_lib snd_hda_codec_generic snd_hda_codec_atih= dmi snd_hda_codec_hdmi intel_rapl_msr snd_hda_intel amd_atl intel_rapl_comm= on snd_hda_codec amd64_edac snd_hda_core btusb kvm_amd snd_intel_dspcfg mt7= 921e btmtk snd_intel_sdw_acpi wireguard btbcm mt7921_common libcurve25519 s= nd_hwdep btintel ip6_udp_tunnel mt792x_lib btrtl kvm ccp snd_pcm udp_tunnel= spd5118 asus_armoury mt76_connac_lib snd_timer bluetooth sp5100_tco bridge= eeepc_wmi aesni_intel atlantic asus_ec_sensors mt76 snd asus_wmi ucsi_acpi= gf128mul firmware_attributes_class i2c_piix4 stp soundcore > Nov 29 18:47:08 kernel: =A0sparse_keymap rapl intel_wmi_thunderbolt wmi_b= mof llc typec_ucsi igc macsec mac80211 k10temp i2c_smbus roles ptp pps_core= prom21_xhci libarc4 mousedev joydev typec cfg80211 gpio_amdpt gpio_generic= rfkill mac_hid nct6775 nct6775_core dm_mod sg uinput crypto_user hwmon_vid= i2c_dev ntsync kvmfr(OE) uas usb_storage thunderbolt nvme nvme_core nvme_k= eyring nvme_auth vmd amdgpu drm_panel_backlight_quirks drm_buddy gpu_sched = amdxcp radeon drm_suballoc_helper drm_ttm_helper ttm i2c_algo_bit drm_displ= ay_helper cec video wmi drm_exec amd libphy mdio_bus vfio_pci vfio_pci_core= irqbypass vfio_iommu_type1 vfio iommufd > Nov 29 18:47:08 kernel: CPU: 25 UID: 0 PID: 3148200 Comm: btrfs-transacti= Tainted: G =A0 =A0 =A0 =A0W =A0OE =A0 =A0 =A0 7.4.0-rc4-1-cachyos-rc #1 PR= EEMPT(full) =A022790e353feb3216cfedcee068c89bbe5f1ff493 > Nov 29 18:47:08 kernel: Tainted: [W]=3DWARN, [O]=3DOOT_MODULE, [E]=3DUNSI= GNED_MODULE > Nov 29 18:47:08 kernel: Hardware name: ASUS System Product Name/ProArt X6= 70E-CREATOR WIFI, BIOS 3112 06/05/2025 > Nov 29 18:47:08 kernel: Sched_ext: rusty_1.1.4_x86_64_unknown_linux_gnu (= enabled+all), task: runnable_at=3D+0ms > Nov 29 18:47:08 kernel: RIP: 0010:btrfs_put_transaction+0x13c/0x190 > Nov 29 18:47:08 kernel: Code: 89 df 5b 41 5c 41 5d 41 5e 41 5f e9 5e d1 d= 2 ff 48 83 c3 10 be 03 00 00 00 48 89 df 5b 41 5c 41 5d 41 5e 41 5f e9 74 b= 3 2c 00 <0f> 0b 48 83 bb 40 01 00 00 00 0f 84 09 ff ff ff 0f 0b 48 83 bb 60 > Nov 29 18:47:08 kernel: RSP: 0018:ffffd2ac0378fdd0 EFLAGS: 00010282 > Nov 29 18:47:08 kernel: RAX: ffff8882ff237828 RBX: ffff8882ff237800 RCX: = ffff8882ff237828 > Nov 29 18:47:08 kernel: RDX: 0000000000000001 RSI: 0000000000000282 RDI: = ffff8882ff237800 > Nov 29 18:47:08 kernel: RBP: ffff8882ff237838 R08: 0000000000000001 R09: = ffffd2ac0378fdb8 > Nov 29 18:47:08 kernel: R10: 0000000000000101 R11: ffffffff8965b608 R12: = ffff8882ff237800 > Nov 29 18:47:08 kernel: R13: ffff8882ff237870 R14: ffff8883e69bf000 R15: = ffff88825b9183e0 > Nov 29 18:47:08 kernel: FS: =A00000000000000000(0000) GS:ffff888ffba30000= (0000) knlGS:0000000000000000 > Nov 29 18:47:08 kernel: CS: =A00010 DS: 0000 ES: 0000 CR0: 00000000800500= 33 > Nov 29 18:47:08 kernel: CR2: 0000123ce1d7b004 CR3: 000000078c6b4000 CR4: = 0000000000f50ef0 > Nov 29 18:47:08 kernel: PKRU: 55555554 > Nov 29 18:47:08 kernel: Call Trace: > Nov 29 18:47:08 kernel: =A0 > Nov 29 18:47:08 kernel: =A0btrfs_commit_transaction+0xa3a/0x1180 > Nov 29 18:47:08 kernel: =A0? btrfs_init_metadata_block_rsv+0x49/0x60 > Nov 29 18:47:08 kernel: =A0transaction_kthread+0x11d/0x1b0 > Nov 29 18:47:08 kernel: =A0? __pfx_transaction_kthread+0x10/0x10 > Nov 29 18:47:08 kernel: =A0kthread+0x100/0x130 > Nov 29 18:47:08 kernel: =A0? __pfx_kthread+0x10/0x10 > Nov 29 18:47:08 kernel: =A0ret_from_fork+0x105/0x9f0 > Nov 29 18:47:08 kernel: =A0? srso_alias_return_thunk+0x5/0xfbef5 > Nov 29 18:47:08 kernel: =A0? __pfx_kthread+0x10/0x10 > Nov 29 18:47:08 kernel: =A0ret_from_fork_asm+0x1a/0x30 > Nov 29 18:47:08 kernel: =A0 > Nov 29 18:47:08 kernel: ---[ end trace 0000000000000000 ]--- >=20 > It is also hanging on the mount instead of returning /sigh... >=20 > OK - it returned after a couple of minutes with: >=20 > mount: /mnt/titan: fsconfig() failed: No space left on device. > =A0 =A0 =A0 =A0dmesg(1) may have more information after failed mount syst= em call. >=20 > And the following lines came immediately after the ---[ end trace ... ]--= - above: >=20 > Nov 29 18:49:59 kernel: BTRFS info (device dm-3 state I): space_info META= DATA (sub-group id 0) has 537411584 free, is full > Nov 29 18:49:59 kernel: BTRFS info (device dm-3 state I): space_info tota= l=3D260919263232, used=3D259378659328, pinned=3D0, reserved=3D33849344, may= _use=3D969211904, readonly=3D131072 zone_unusable=3D0 > Nov 29 18:49:59 kernel: BTRFS info (device dm-3 state I): global_block_rs= v: size 0 reserved 0 > Nov 29 18:49:59 kernel: BTRFS info (device dm-3 state I): trans_block_rsv= : size 0 reserved 0 > Nov 29 18:49:59 kernel: BTRFS info (device dm-3 state I): chunk_block_rsv= : size 0 reserved 0 > Nov 29 18:49:59 kernel: BTRFS info (device dm-3 state I): remap_block_rsv= : size 0 reserved 0 > Nov 29 18:49:59 kernel: BTRFS info (device dm-3 state I): delayed_block_r= sv: size 0 reserved 0 > Nov 29 18:49:59 kernel: BTRFS info (device dm-3 state I): delayed_refs_rs= v: size 2037383168 reserved 969211904 > Nov 29 18:49:59 kernel: BTRFS error (device dm-3 state I): open_ctree fai= led: -ENOSPC > So I was initially talking to google and it suggested: >=20 > sudo mount -o rw,rescue=3Dnologreplay,skip_balance,compress=3Dzstd,noatim= e -L "Titan A.E." /mnt/titan =A0&& sudo btrfs device add /dev/mapper/titan5= /mnt/titan > (I changed to a label vs device) but it's otherwise the command it sugges= ted): > To which I see in the logs: >=20 > [Sun Nov 29 19:00:43 2026] BTRFS info (device dm-3): first mount of files= ystem a6b3e68c-c168-4ebd-8f23-a423ce2682b7 > [Sun Nov 29 19:00:43 2026] BTRFS info (device dm-3): using sha256 checksu= m algorithm > [Sun Nov 29 19:00:43 2026] BTRFS error (device dm-3): nologreplay must be= used with ro mount option > [Sun Nov 29 19:00:43 2026] BTRFS error (device dm-3): open_ctree failed: = -EINVAL > [Sun Nov 29 19:01:04 2026] BTRFS info (device dm-3): first mount of files= ystem a6b3e68c-c168-4ebd-8f23-a423ce2682b7 > [Sun Nov 29 19:01:04 2026] BTRFS info (device dm-3): using sha256 checksu= m algorithm > [Sun Nov 29 19:01:04 2026] BTRFS error (device dm-3): nologreplay must be= used with ro mount option > [Sun Nov 29 19:01:04 2026] BTRFS error (device dm-3): open_ctree failed: = -EINVAL > [Sun Nov 29 19:02:39 2026] BTRFS info (device dm-3): first mount of files= ystem a6b3e68c-c168-4ebd-8f23-a423ce2682b7 > [Sun Nov 29 19:02:39 2026] BTRFS info (device dm-3): using sha256 checksu= m algorithm > [Sun Nov 29 19:02:41 2026] BTRFS info (device dm-3): enabling free space = tree > [Sun Nov 29 19:02:41 2026] BTRFS info (device dm-3): use zstd compression= , level 3 > [Sun Nov 29 19:03:04 2026] BTRFS error (device dm-3): parent transid veri= fy failed on logical 30801920 mirror 4 wanted 84023 found 84031 > [Sun Nov 29 19:03:04 2026] BTRFS warning (device dm-3): missing free spac= e info for 9521972903936 > > [Sun Nov 29 19:03:04 2026] BTRFS warning (device dm-3): missing free spac= e info for 21425474764800 > [Sun Nov 29 19:03:04 2026] BTRFS error (device dm-3): parent transid veri= fy failed on logical 30801920 mirror 2 wanted 84031 found 84023 > [Sun Nov 29 19:03:04 2026] BTRFS error (device dm-3): parent transid veri= fy failed on logical 30801920 mirror 2 wanted 84031 found 84023 > [Sun Nov 29 19:03:04 2026] BTRFS error (device dm-3): parent transid veri= fy failed on logical 30801920 mirror 1 wanted 84031 found 84023 > [Sun Nov 29 19:03:04 2026] BTRFS error (device dm-3): parent transid veri= fy failed on logical 30801920 mirror 3 wanted 84031 found 84023 > [Sun Nov 29 19:03:04 2026] BTRFS error (device dm-3): parent transid veri= fy failed on logical 30801920 mirror 4 wanted 84031 found 84023 Now it's likely permanent metadata damage. > [Sun Nov 29 19:03:04 2026] BTRFS error (device dm-3): failed to run delay= ed ref for logical 26148864 num_bytes 16384 type 176 action 1 ref_mod 1: -5 > [Sun Nov 29 19:03:04 2026] BTRFS error (device dm-3 state A): Transaction= 84031 aborted (-EIO) > [Sun Nov 29 19:03:04 2026] BTRFS: error (device dm-3 state A) in btrfs_ru= n_delayed_refs:2248: errno=3D-5 IO failure > [Sun Nov 29 19:03:04 2026] BTRFS info (device dm-3 state EA): forced read= only >=20 > So at this point I'm chicken-and-egg re: I need to free space to free spa= ce!!! >=20 > How in the heck is there not *always* enough reserved space for > these kind of operations? =A0That feels like a filesystem oversite - > am I wrong? Normally there is enough metadata allocated to allow data to grow, but it's possible to reduce metadata allocations by balancing (which is why metadata should never be balanced) or increase metadata usage by doing a metadata-intensive operation while the filesystem is very full, like a snapshot delete, or millions of mkdir operations (which blows out all previous estimates for how much metadata you need). SHA256 csums might throw off some of the estimates for metadata size. That's just a guess. Normally a proper balance regimen has a much larger effect. > I guess - more to the point - is how to I fix this? =A0I still seem > to be able to mount read-only so I can *eventually* back everything > up to another medium (I have 2 offline backups (ie a 22tb removable > drive and a 4xraid 0 (not redundant) 18tb of useable storage) that > between the 2 systems I have a second copy of everything I own - > although I need to update those with my latest files /sigh... >=20 > I will update my backups regardless. =A0Is there anyway I can get out > of this chicken-and-egg without wiping and redoing my entire array? Only if btrfs check comes back clean; otherwise, it's wipe and restore. > I can include logs if they would help - I feel like this error isn't > new - from googling around - I've even encountered errors about a year > ago that had me backing up / starting over fresh and doing raid5 with > metadata 1c4 so I wouldn't have metadata failures - at least. >=20 > Anyway - I'm at my wits end. =A0Any help would be appreciated. >=20 > Thank you (and sorry for the long post)... >=20 >=20 > J >=20