Bug 210765

Summary: F2FS causes access invalid blkaddr
Product: File System Reporter: Stefan de Konink (stefan)
Component: f2fsAssignee: Default virtual assignee for f2fs (filesystem_f2fs)
Status: ASSIGNED ---    
Severity: blocking CC: chao, junkmailnotread, sam
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 5.10.1 Subsystem:
Regression: No Bisected commit-id:

Description Stefan de Konink 2020-12-18 01:04:21 UTC
I am reporting this incident here because I noticed some recent changes within the F2FS layer. I'll cross post this incident at the Gentoo bugtracker, because I am using the gentoo patchset.

I am using F2FS as my root filesystem. Today I upgraded from 5.9.11-gentoo to 5.10.1-gentoo. After I upgraded glibc programs could not find libstdc++.so.6. Long story short at least /etc/env.d/00glibc and /etc/nsswitch.conf became corrupt, and when on kernel 5.10.1-gentoo I could consistently cause the problems below (twice including a reboot, filesystem checked with a LiveCD). When switching back to 5.9.11-gentoo, upgrading glibc did not cause any further issues.

I am aware that non-vanilla kernels, including tainted modules, are not supported here.


[  701.466276] WARNING: CPU: 4 PID: 66867 at fs/f2fs/checkpoint.c:189 f2fs_is_valid_blkaddr+0x25f/0x270[
[  701.469213] Modules linked in: cmac bnep joydev zfs(PO) zunicode(PO) zzstd(O) zlua(O) zavl(PO) icp(PO) uvcvideo videobuf2_vmalloc ath10k_pci videobuf2_memops videobuf2_v4l2 snd_usb_audio btusb snd_hwdep zcommon(PO) btrtl snd_usbmidi_lib ath10k_core videodev znvpair(PO) btbcm wmi_bmof ath snd_rawmidi videobuf2_common btintel spl(O) bluetooth ecdh_generic amdgpu kvm_amd zlib_deflate ecc zlib_inflate mac80211 kvm irqbypass snd_hda_codec_conexant snd_hda_codec_generic snd_hda_codec_hdmi aesni_intel crypto_simd mfd_core cryptd snd_hda_intel gpu_sched glue_helper snd_intel_dspcfg evdev psmouse snd_hda_codec ttm i2c_algo_bit sdhci_pci snd_hda_core drm_kms_helper iosf_mbi syscopyarea sysfillrect sysimgblt snd_pcm fb_sys_fops cec cqhci snd_timer ccp sdhci cfg80211 i2c_piix4 r8169 sha1_generic libarc4 mmc_core realtek thinkpad_acpi mdio_devres libphy nvram wireguard ledtrig_audio ip6_udp_tunnel snd udp_tunnel soundcore wmi rfkill ac battery video i2c_scmi button sch_fq_codel drm backlight i2c_core
[  701.469299]  efivarfs
[  701.486729] CPU: 4 PID: 66867 Comm: python3.7m Tainted: P        W  O      5.10.1-gentoo #1
[  701.489555] Hardware name: LENOVO 20KU000NMH/20KU000NMH, BIOS R0UET77W (1.57 ) 04/07/2020
[  701.492291] RIP: 0010:f2fs_is_valid_blkaddr+0x25f/0x270
[  701.494964] Code: 41 f7 41 30 44 01 c0 39 c6 73 09 41 8b 41 5c e9 fe fe ff ff 89 f2 48 89 df 48 c7 c6 fa e4 f5 81 e8 80 f9 41 00 f0 80 4b 48 04 <0f> 0b 31 c0 5b c3 0f 0b 66 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00
[  701.497674] RSP: 0018:ffffc9000f83fe70 EFLAGS: 00010282
[  701.500374] RAX: 0000000000000000 RBX: ffff888101a6f000 RCX: 0000000000000000
[  701.502979] RDX: 0000000000000000 RSI: ffff88844ef12d40 RDI: ffff88844ef12d40
[  701.505524] RBP: 0000000000000001 R08: ffffffff8226b1e8 R09: 00000000fffff7ff
[  701.508011] R10: ffffffff8225f200 R11: 00000000fffff800 R12: ffff8881433d9640
[  701.510494] R13: 0000160000000000 R14: 0000000000001000 R15: 0000000000000003
[  701.512878] FS:  00007f581c2ef740(0000) GS:ffff88844ef00000(0000) knlGS:0000000000000000
[  701.515216] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  701.517499] CR2: 00007f581ba40000 CR3: 0000000174626000 CR4: 00000000003506e0
[  701.519792] Call Trace:
[  701.521970]  f2fs_llseek+0x23e/0x490
[  701.524089]  __x64_sys_lseek+0x82/0xc0
[  701.526205]  do_syscall_64+0x33/0x40
[  701.528258]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  701.530299] RIP: 0033:0x7f581c87d377
[  701.532256] Code: 00 00 90 48 8b 15 f1 ca 0c 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b2 66 2e 0f 1f 84 00 00 00 00 00 90 b8 08 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 8b 15 c1 ca 0c 00 f7 d8 64 89 02 48
[  701.534269] RSP: 002b:00007fffc5549628 EFLAGS: 00000202 ORIG_RAX: 0000000000000008
[  701.536267] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f581c87d377
[  701.538258] RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000003
[  701.540295] RBP: 00007fffc5549680 R08: 0000000000000000 R09: 00007fffc55492f0
[  701.542268] R10: 00007fffc55492f0 R11: 0000000000000202 R12: 0000000000000003
[  701.544178] R13: 0000000000000004 R14: 0000000000000002 R15: 00007fffc5549680
[  701.546029] ---[ end trace a0930f5707057a19 ]---
[  701.548199] F2FS-fs (sda4): access invalid blkaddr:539167267
[  701.550010] ------------[ cut here ]------------
Comment 1 Chao Yu 2020-12-18 01:15:16 UTC
Fixed in 5.11, could you please backport this patch?

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7a6e59d719ef0ec9b3d765cba3ba98ee585cbde3
Comment 2 junkmailnotread 2020-12-18 14:01:20 UTC
I had exactly the same problem. The preceding patch fixed it for me. Thanks.