Bug 203621

Summary: filefrag on ro-blockdevice btrfs causes delayed_refs has NO entry / btrfs_update_root:136: Aborting unused transaction(No space left).
Product: File System Reporter: Christoph Anton Mitterer (calestyo)
Component: btrfsAssignee: BTRFS virtual assignee (fs_btrfs)
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.7.10 Subsystem:
Regression: No Bisected commit-id:

Description Christoph Anton Mitterer 2019-05-16 09:11:30 UTC
from: https://www.spinics.net/lists/linux-btrfs/msg87585.html

As described in the thread above (log messages attached there), when filefrag is used on a btrfs which is on a blockdevice that is set readonly, it leads errors like:
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): Skipping commit of aborted transaction.
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): cleanup_transaction:1846: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS info (device dm-2): delayed_refs has NO entry
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): btrfs_update_root:136: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): Skipping commit of aborted transaction.
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): cleanup_transaction:1846: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS info (device dm-2): delayed_refs has NO entry
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): btrfs_update_root:136: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): Skipping commit of aborted transaction.
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): cleanup_transaction:1846: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS info (device dm-2): delayed_refs has NO entry
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): btrfs_update_root:136: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): Skipping commit of aborted transaction.
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): cleanup_transaction:1846: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS info (device dm-2): delayed_refs has NO entry
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): btrfs_update_root:136: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): Skipping commit of aborted transaction.
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): cleanup_transaction:1846: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS info (device dm-2): delayed_refs has NO entry
Mar 16 18:27:28 heisenberg kernel: BTRFS warning (device dm-2): btrfs_update_root:136: Aborting unused transaction(No space left).
Mar 16 18:27:28 heisenberg kernel: BTRFS info (device dm-2): delayed_refs has NO entry

See https://www.spinics.net/lists/linux-btrfs/msg88573.html for a reproducer.
Comment 1 Christoph Anton Mitterer 2020-08-05 01:17:51 UTC
Still the case in 5.7.10,... though the kernel output looks a bit different:

Aug 04 19:09:05 heisenberg kernel: BTRFS warning (device dm-1): Skipping commit of aborted transaction.
Aug 04 19:09:05 heisenberg kernel: ------------[ cut here ]------------
Aug 04 19:09:05 heisenberg kernel: BTRFS: Transaction aborted (error -28)
Aug 04 19:09:05 heisenberg kernel: WARNING: CPU: 0 PID: 28465 at fs/btrfs/transaction.c:1894 cleanup_transaction+0x61/0xc0 [btrfs]
Aug 04 19:09:05 heisenberg kernel: Modules linked in: uas xt_CHECKSUM xt_MASQUERADE nft_chain_nat nf_nat tun bridge stp llc ctr ccm fuse cpufreq_userspace cpufreq_powersave cpufreq_conservative intel_rapl_msr intel_rapl_common snd_hda_codec_hdmi snd_soc_skl snd_soc_hdac_hda snd_hda_ext_core snd_hda_codec_realtek x86_pkg_temp_thermal snd_soc_sst_ipc intel_powerclamp snd_hda_codec_generic snd_soc_sst_dsp coretemp snd_soc_acpi_intel_match snd_soc_acpi ledtrig_audio iwlmvm btusb btrtl kvm_intel snd_soc_core iTCO_wdt snd_compress kvm snd_hda_intel btbcm irqbypass crc32_pclmul mei_wdt btintel snd_intel_dspcfg iTCO_vendor_support mac80211 uvcvideo i2c_designware_platform hid_generic libarc4 i2c_designware_core intel_wmi_thunderbolt watchdog snd_hda_codec bluetooth videobuf2_vmalloc ghash_clmulni_intel snd_usb_audio snd_hda_core rapl snd_usbmidi_lib snd_rawmidi intel_cstate videobuf2_memops videobuf2_v4l2 snd_seq_device sdhci_pci snd_hwdep videobuf2_common intel_uncore iwlwifi cqhci cdc_mbim snd_pcm cdc_wdm drbg pcspkr
Aug 04 19:09:05 heisenberg kernel:  xt_tcpudp joydev ansi_cprng cdc_ncm usbhid sdhci videodev snd_timer ecdh_generic usbnet ip6t_REJECT ecc snd nf_reject_ipv6 i2c_i801 mmc_core intel_lpss_pci hid cfg80211 mii mei_me soundcore nft_counter intel_lpss sg rfkill mc crc16 idma64 mei mfd_core wmi battery button tpm_crb tpm_tis tpm_tis_core xt_comment fujitsu_laptop ac tpm ipt_REJECT sparse_keymap nf_reject_ipv4 acpi_pad rng_core xt_multiport xt_policy xt_state xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nft_compat nf_tables nfnetlink binfmt_misc loop parport_pc ppdev lp parport sunrpc ip_tables x_tables autofs4 dm_crypt dm_mod raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx raid1 raid0 multipath linear md_mod btrfs blake2b_generic libcrc32c crc32c_generic xor zstd_decompress zstd_compress raid6_pq uhci_hcd ehci_pci ehci_hcd usb_storage sd_mod t10_pi crc_t10dif crct10dif_generic i915 crct10dif_pclmul crct10dif_common crc32c_intel aesni_intel i2c_algo_bit glue_helper libaes
Aug 04 19:09:05 heisenberg kernel:  crypto_simd drm_kms_helper xhci_pci ahci e1000e libahci cryptd cec xhci_hcd psmouse libata evdev serio_raw drm usbcore scsi_mod ptp pps_core usb_common video
Aug 04 19:09:05 heisenberg kernel: CPU: 0 PID: 28465 Comm: btrfs-transacti Not tainted 5.7.0-2-amd64 #1 Debian 5.7.10-1
Aug 04 19:09:05 heisenberg kernel: Hardware name: FUJITSU LIFEBOOK U757/FJNB2A5, BIOS Version 1.25 12/20/2019
Aug 04 19:09:05 heisenberg kernel: RIP: 0010:cleanup_transaction+0x61/0xc0 [btrfs]
Aug 04 19:09:05 heisenberg kernel: Code: 77 66 f0 49 0f ba ad 40 0a 00 00 02 72 1e 41 83 fc fb 75 07 0f 1f 44 00 00 eb 11 44 89 e6 48 c7 c7 c8 c0 84 c0 e8 01 b9 ae e5 <0f> 0b 44 89 e1 ba 66 07 00 00 49 8d 5e 28 48 89 ef 48 c7 c6 d0 f5
Aug 04 19:09:05 heisenberg kernel: RSP: 0018:ffffa6828864bde8 EFLAGS: 00010282
Aug 04 19:09:05 heisenberg kernel: RAX: 0000000000000000 RBX: 00000000ffffffe4 RCX: 0000000000000007
Aug 04 19:09:05 heisenberg kernel: RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff9a247dc19ac0
Aug 04 19:09:05 heisenberg kernel: RBP: ffff9a2470477d00 R08: 000000000000047e R09: 0000000000000007
Aug 04 19:09:05 heisenberg kernel: R10: 0000000000000000 R11: 0000000000000001 R12: 00000000ffffffe4
Aug 04 19:09:05 heisenberg kernel: R13: ffff9a24749d6000 R14: ffff9a227bc42600 R15: ffff9a2470477c50
Aug 04 19:09:05 heisenberg kernel: FS:  0000000000000000(0000) GS:ffff9a247dc00000(0000) knlGS:0000000000000000
Aug 04 19:09:05 heisenberg kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Aug 04 19:09:05 heisenberg kernel: CR2: 00007fffa14efe08 CR3: 000000063ae28006 CR4: 00000000003606f0
Aug 04 19:09:05 heisenberg kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Aug 04 19:09:05 heisenberg kernel: DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Aug 04 19:09:05 heisenberg kernel: Call Trace:
Aug 04 19:09:05 heisenberg kernel:  btrfs_commit_transaction+0x2a8/0xa30 [btrfs]
Aug 04 19:09:05 heisenberg kernel:  ? start_transaction+0xd2/0x540 [btrfs]
Aug 04 19:09:05 heisenberg kernel:  transaction_kthread+0x13c/0x180 [btrfs]
Aug 04 19:09:05 heisenberg kernel:  kthread+0xf9/0x130
Aug 04 19:09:05 heisenberg kernel:  ? btrfs_cleanup_transaction+0x590/0x590 [btrfs]
Aug 04 19:09:05 heisenberg kernel:  ? kthread_park+0x90/0x90
Aug 04 19:09:05 heisenberg kernel:  ret_from_fork+0x35/0x40
Aug 04 19:09:05 heisenberg kernel: ---[ end trace 67feda0e1863e46e ]---
Aug 04 19:09:05 heisenberg kernel: BTRFS: error (device dm-1) in cleanup_transaction:1894: errno=-28 No space left


again, the block device was set ro, and even though the whole operation is apparently ro (the fs is also mounted ro)... btrfs aborts transactions.