public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: Marc MERLIN <marc_btrfs@merlins.org>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: Simple quota unsafe? RIP: 0010:__btrfs_free_extent.isra.0+0xc41/0x1020 [btrfs] / do_free_extent_accounting:2999: errno=-2 No such entry
Date: Thu, 16 Apr 2026 14:36:32 -0700	[thread overview]
Message-ID: <20260416213632.GA1654609@zen.localdomain> (raw)
In-Reply-To: <aeEaqCJAWaWbz1vO@merlins.org>

On Thu, Apr 16, 2026 at 10:21:44AM -0700, Marc MERLIN wrote:
> No help needed, just showing it happened overnight with balance and squota in 6.19
> on my laptop. It looks like squota and balance are simply not compatible until the
> fix for squota, lands.
> Now that I know more, I rescued the FS and removed squota on my own and it's good again.
> 
> It looks pretty clear that btrfs balance seems to trigger the bug in
> squota:

Thank you for the additional report, this is helpful. I am attempting to
reproduce directly with balance to be sure I've got everything.

One question just to be extra careful:
In all these situations, were you ever manually managing either the
subvolumes or the qgroups? e.g., when, if ever, where you deleting
qgroups and / or subvols?

Thanks,
Boris

> [37930.185472] BTRFS info (device dm-3): balance: start -dusage=20
> [37930.187010] BTRFS info (device dm-3): relocating block group 4502498312192 flags data
> [37930.417388] BTRFS info (device dm-3): found 83 extents, stage: move data extents
> [37930.896615] BTRFS info (device dm-3): found 83 extents, stage: update data pointers
> [37931.311770] BTRFS info (device dm-3): relocating block group 4501424570368 flags data
> [37931.355759] BTRFS info (device dm-3): found 11 extents, stage: move data extents
> [37931.501741] BTRFS info (device dm-3): found 11 extents, stage: update data pointers
> [37931.507435] BTRFS: Transaction aborted (error -2)
> [37931.508762] BTRFS: error (device dm-3 state A) in do_free_extent_accounting:3002: errno=-2 No such entry
> [37931.508766] BTRFS info (device dm-3 state EA): forced readonly
> [37931.508769] BTRFS error (device dm-3 state EA): failed to run delayed ref for logical 907535646720 num_bytes 16384 type 182 action 2 ref_mod 1: -2
> [37931.508773] BTRFS: error (device dm-3 state EA) in btrfs_run_delayed_refs:2166: errno=-2 No such entry
> [37931.508798] BTRFS info (device dm-3 state EA): balance: ended with status: -2
> 
> [37931.507428] ------------[ cut here ]------------
> [37931.507435] BTRFS: Transaction aborted (error -2)
> [37931.507438] WARNING: fs/btrfs/extent-tree.c:3002 at __btrfs_free_extent.isra.0+0xdf6/0xfe0 [btrfs], CPU#0: btrfs/153883
> [37931.507519] Modules linked in: rpcsec_gss_krb5 nfsv4 dns_resolver nfs netfs sd_mod sg uas usb_storage uinput nf_conntrack_netlink xfrm_user xfrm_algo xt_addrtype br_netfilter bridge stp llc xt_tcpudp xt_conntrack ccm rfcomm snd_seq_dummy snd_hrtimer overlay ipt_REJECT nf_reject_ipv4 xt_MASQUERADE xt_LOG nf_log_syslog nft_compat nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 qrtr nf_tables cmac algif_hash algif_skcipher af_alg bnep binfmt_misc uvcvideo btusb videobuf2_vmalloc btmtk uvc videobuf2_memops btrtl videobuf2_v4l2 btbcm btintel videodev videobuf2_common bluetooth mc ftdi_sio ecdh_generic usbserial nls_ascii nls_cp437 vfat fat ext4 crc16 mbcache squashfs jbd2 loop intel_uncore_frequency intel_uncore_frequency_common x86_pkg_temp_thermal iwlmvm intel_powerclamp snd_hda_codec_intelhdmi kvm_intel snd_hda_codec_alc269 snd_hda_scodec_component snd_hda_codec_realtek_lib mac80211 snd_hda_codec_generic kvm snd_soc_dmic rtsx_pci_sdmmc mmc_core libarc4 snd_sof_pci_intel_tgl irqbypass mei_hdcp mei_pxp
> [37931.507593]  intel_rapl_msr snd_sof_pci_intel_cnl rapl intel_cstate snd_sof_intel_hda_generic soundwire_intel snd_sof_pci snd_sof_xtensa_dsp snd_sof_intel_hda_sdw_bpt processor_thermal_device_pci_legacy iwlwifi intel_uncore think_lmi snd_sof_intel_hda_common iTCO_wdt snd_soc_sdw_utils processor_thermal_device processor_thermal_wt_hint intel_pmc_bxt snd_soc_hdac_hda firmware_attributes_class snd_hda_intel platform_temperature_control wmi_bmof iTCO_vendor_support snd_sof_intel_hda_mlink processor_thermal_soc_slider snd_soc_avs cfg80211 processor_thermal_rfim ee1004 snd_sof_intel_hda processor_thermal_rapl watchdog pcspkr snd_soc_hda_codec rtsx_pci snd_hda_codec_hdmi intel_rapl_common ucsi_acpi processor_thermal_wt_req typec_ucsi mei_me soundwire_cadence processor_thermal_power_floor mei snd_hda_ext_core typec soundwire_generic_allocation processor_thermal_mbox crc8 roles soundwire_bus thinkpad_acpi intel_soc_dts_iosf snd_sof_probes nvram platform_profile int3403_thermal snd_sof rfkill int340x_thermal_zone ac
> [37931.507644]  intel_pmc_core snd_sof_utils pmt_telemetry snd_intel_dspcfg pmt_discovery pmt_class snd_intel_sdw_acpi int3400_thermal joydev intel_hid intel_pmc_ssram_telemetry sparse_keymap snd_soc_skl_hda_dsp acpi_thermal_rel snd_soc_intel_sof_board_helpers acpi_pad button acpi_tad snd_soc_acpi_intel_match evdev snd_soc_acpi_intel_sdca_quirks snd_soc_acpi serio_raw snd_soc_sdca snd_soc_core snd_compress snd_pcm_dmaengine snd_soc_intel_hda_dsp_common snd_hda_codec snd_hda_core snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_midi snd_seq_midi_event snd_seq snd_timer snd_rawmidi snd_seq_device snd_ctl_led snd nfsd soundcore ac97_bus coretemp auth_rpcgss msr ecryptfs nfs_acl lockd grace efi_pstore sunrpc nfnetlink ip_tables x_tables autofs4 crc32c_cryptoapi essiv authenc btrfs blake2b libblake2b dm_crypt dm_mod efivarfs raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq raid1 raid0 md_mod sata_sil24 libata scsi_mod scsi_common e1000e r8169 realtek mii xe intel_vsec drm_gpuvm
> [37931.507715]  configfs drm_gpusvm_helper gpu_sched drm_ttm_helper drm_exec drm_suballoc_helper hid_generic usbhid hid i915 drm_buddy ttm i2c_algo_bit drm_display_helper xhci_pci cec nvme xhci_hcd rc_core nvme_core drm_client_lib usbcore drm_kms_helper nvme_keyring video i2c_i801 ghash_clmulni_intel psmouse i2c_smbus nvme_auth igc hkdf drm thunderbolt usb_common battery wmi aesni_intel
> [37931.507761] CPU: 0 UID: 0 PID: 153883 Comm: btrfs Tainted: G S   U              6.19.11+deb14-amd64 #1 PREEMPT(lazy)  Debian 6.19.11-1 
> [37931.507765] Tainted: [S]=CPU_OUT_OF_SPEC, [U]=USER
> [37931.507767] Hardware name: LENOVO 20YU002JUS/20YU002JUS, BIOS N37ET61W (1.97 ) 09/17/2025
> [37931.507769] RIP: 0010:__btrfs_free_extent.isra.0+0xdfa/0xfe0 [btrfs]
> [37931.507830] Code: 48 c7 c6 50 e1 a0 c1 48 8b 78 60 e8 30 80 0f 00 e8 4b e9 62 d9 44 88 6c 24 2f e9 98 aa 0e 00 48 8d 3d 6a 49 f4 ff 8b 74 24 14 <67> 48 0f b9 3a e9 ef fd ff ff 48 8d 3d 65 49 f4 ff 8b 74 24 14 67
> [37931.507833] RSP: 0018:ffffcc4b75297800 EFLAGS: 00010206
> [37931.507836] RAX: 000000000000001c RBX: 000000d34d570000 RCX: ffff891a04502000
> [37931.507838] RDX: 0000000000000000 RSI: 00000000fffffffe RDI: ffffffffc176e990
> [37931.507840] RBP: 0000000000000000 R08: ffff89275fe8e2d0 R09: ffff89275fe8e2d0
> [37931.507842] R10: ffff891a04502000 R11: 0000000000000011 R12: 0000000000004000
> [37931.507843] R13: 0000000000000000 R14: ffff892b31377380 R15: 0000000000000010
> [37931.507845] FS:  00007fa538c1d3c0(0000) GS:ffff893951da7000(0000) knlGS:0000000000000000
> [37931.507847] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [37931.507849] CR2: 00003c840b875500 CR3: 00000010f962b005 CR4: 0000000000f70ef0
> [37931.507851] PKRU: 55555554
> [37931.507853] Call Trace:
> [37931.507856]  <TASK>
> [37931.507862]  __btrfs_run_delayed_refs+0x2e3/0xfb0 [btrfs]
> [37931.507915]  ? need_preemptive_reclaim+0x36/0x190 [btrfs]
> [37931.507976]  ? reserve_bytes+0x177/0x4a0 [btrfs]
> [37931.508032]  btrfs_run_delayed_refs+0x3b/0x120 [btrfs]
> [37931.508085]  btrfs_commit_transaction+0x6a/0xd50 [btrfs]
> [37931.508142]  ? btrfs_init_metadata_block_rsv+0x28/0x40 [btrfs]
> [37931.508200]  ? start_transaction+0x228/0x840 [btrfs]
> [37931.508256]  prepare_to_relocate+0x135/0x1d0 [btrfs]
> [37931.508323]  relocate_block_group+0x6b/0x530 [btrfs]
> [37931.508382]  btrfs_relocate_block_group+0x26e/0x3d0 [btrfs]
> [37931.508439]  btrfs_relocate_chunk+0x44/0x170 [btrfs]
> [37931.508504]  btrfs_balance+0xa5b/0x1640 [btrfs]
> [37931.508568]  btrfs_ioctl+0x28ac/0x2dd0 [btrfs]
> [37931.508635]  ? kmem_cache_free+0x508/0x550
> [37931.508640]  ? dput.part.0+0x27/0x110
> [37931.508643]  ? __x64_sys_close+0x3d/0x80
> [37931.508647]  __x64_sys_ioctl+0x97/0xe0
> [37931.508651]  do_syscall_64+0x81/0x5e0
> [37931.508656]  ? syscall_exit_work+0x143/0x1b0
> [37931.508665]  ? do_syscall_64+0xbe/0x5e0
> [37931.508671]  ? syscall_exit_work+0x143/0x1b0
> [37931.508674]  ? do_syscall_64+0xbe/0x5e0
> [37931.508676]  ? kernfs_fop_llseek+0x78/0xc0
> [37931.508682]  ? syscall_exit_work+0x143/0x1b0
> [37931.508685]  ? do_syscall_64+0xbe/0x5e0
> [37931.508687]  ? clear_bhb_loop+0x50/0xa0
> [37931.508690]  ? clear_bhb_loop+0x50/0xa0
> [37931.508692]  ? clear_bhb_loop+0x50/0xa0
> [37931.508695]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
> [37931.508697] RIP: 0033:0x7fa538d3ad3b
> [37931.508741] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1c 48 8b 44 24 18 64 48 2b 04 25 28 00 00
> [37931.508744] RSP: 002b:00007fff72a15140 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> [37931.508747] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa538d3ad3b
> [37931.508749] RDX: 00007fff72a15228 RSI: 00000000c4009420 RDI: 0000000000000003
> [37931.508750] RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
> [37931.508752] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff72a15228
> [37931.508753] R13: 00007fff72a15bd8 R14: 00007fff72a17da5 R15: 0000000000000001
> [37931.508756]  </TASK>
> [37931.508758] ---[ end trace 0000000000000000 ]---
> [37931.508762] BTRFS: error (device dm-3 state A) in do_free_extent_accounting:3002: errno=-2 No such entry
> [37931.508766] BTRFS info (device dm-3 state EA): forced readonly
> [37931.508769] BTRFS error (device dm-3 state EA): failed to run delayed ref for logical 907535646720 num_bytes 16384 type 182 action 2 ref_mod 1: -2
> [37931.508773] BTRFS: error (device dm-3 state EA) in btrfs_run_delayed_refs:2166: errno=-2 No such entry
> 
> sauron:/boot# mount /dev/mapper/pool4 /mnt/btrfs_pool4
> [65964.162801] BTRFS error (device dm-3 state EMA): remounting read-write after error is not allowed
> 
> For google and people who find that thread, the quicker recovery is:
> sauron:/mnt/btrfs_pool3# btrfs rescue clear-ino-cache  /dev/mapper/pool4
> (...)
> Successfully cleaned up ino cache for root id: 108518
> Successfully cleared ino cache
> sauron:/mnt/btrfs_pool3# mount -o rw,clear_cache,enospc_debug,skip_balance LABEL=btrfs_pool4 /mnt/btrfs_pool4
> sauron:/mnt/btrfs_pool3# btrfs quota disable /mnt/btrfs_pool4
> 
> sauron:/mnt/btrfs_pool3# mount /dev/mapper/pool4 /mnt/btrfs_pool4
> sauron:/mnt/btrfs_pool3# cd /mnt/btrfs_pool4
> sauron:/mnt/btrfs_pool4# btrfs balance start -dusage=20  `pwd`
> Done, had to relocate 0 out of 2008 chunks
> sauron:/mnt/btrfs_pool4# 
> 
> btrfs tune would have likely also worked to remove squota, but the trick
> after that is mounting with skip_balance or otherwise, even after quota
> removal, balance restarts right away and puts the FS read only again
> if squota isn't disabled first.
> 
> Marc
> -- 
> "A mouse is a device used to point at the xterm you want to type in" - A.S.R.
>  
> Home page: http://marc.merlins.org/                       | PGP 7F55D5F27AAF9D08

  reply	other threads:[~2026-04-16 21:36 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-11  3:35 BTRFS discard crash: failed to run delayed ref for logical 15506102321152 num_bytes 16384 type 182 action 2 ref_mod 1: -2 6.11.2) Marc MERLIN
2026-04-11  4:47 ` Qu Wenruo
2026-04-11 12:04 ` Roman Mamedov
2026-04-11 16:22   ` Marc MERLIN
2026-04-12  1:57 ` Marc MERLIN
2026-04-12  1:57   ` Marc MERLIN
2026-04-12  2:28   ` Marc MERLIN
2026-04-12  2:28     ` Marc MERLIN
2026-04-12 17:38     ` Marc MERLIN
2026-04-12 17:38       ` Marc MERLIN
2026-04-12 20:21       ` Marc MERLIN
2026-04-12 20:21         ` Marc MERLIN
2026-04-13  2:14         ` Roman Mamedov
2026-04-13  2:34           ` Marc MERLIN
2026-04-13  2:34             ` Marc MERLIN
2026-04-13 17:52 ` Simple quota unsafe? RIP: 0010:__btrfs_free_extent.isra.0+0xc41/0x1020 [btrfs] / do_free_extent_accounting:2999: errno=-2 No such entry Marc MERLIN
2026-04-13 17:52   ` Marc MERLIN
2026-04-13 18:47   ` Boris Burkov
2026-04-13 19:40     ` Marc MERLIN
2026-04-13 19:40       ` Marc MERLIN
2026-04-15  5:21       ` Marc MERLIN
2026-04-15 17:05         ` Boris Burkov
2026-04-15 17:59           ` Marc MERLIN
2026-04-15 18:44             ` Boris Burkov
2026-04-15 20:22               ` Marc MERLIN
2026-04-15 22:36                 ` Boris Burkov
2026-04-15 22:55                   ` Marc MERLIN
2026-04-15 23:25                     ` Boris Burkov
2026-04-16  0:55                       ` Marc MERLIN
2026-04-16  1:22                         ` Boris Burkov
2026-04-16  0:45                     ` Boris Burkov
2026-04-16  1:08                       ` Marc MERLIN
2026-04-16  1:25                         ` Boris Burkov
2026-04-16 16:51                           ` Simple quota unsafe (FIXED: btrfstune --remove-simple-quota worked) Marc MERLIN
2026-04-16 17:21                           ` Simple quota unsafe? RIP: 0010:__btrfs_free_extent.isra.0+0xc41/0x1020 [btrfs] / do_free_extent_accounting:2999: errno=-2 No such entry Marc MERLIN
2026-04-16 21:36                             ` Boris Burkov [this message]
2026-04-16 21:47                               ` Marc MERLIN
2026-04-17 21:51                                 ` Boris Burkov
2026-04-17 22:37                                   ` Marc MERLIN
2026-04-17 23:16                                     ` Boris Burkov
2026-04-18  0:18                                       ` Marc MERLIN
2026-04-17  3:43 ` BTRFS discard crash: failed to run delayed ref for logical 15506102321152 num_bytes 16384 type 182 action 2 ref_mod 1: -2 6.11.2) David Disseldorp
2026-04-17  5:19   ` Marc MERLIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260416213632.GA1654609@zen.localdomain \
    --to=boris@bur.io \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=marc_btrfs@merlins.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox