linux-stable/fs/f2fs
Chao Yu 10d255c354 f2fs: fix to skip GC if type in SSA and SIT is inconsistent
If segment type in SSA and SIT is inconsistent, we will encounter below
BUG_ON during GC, to avoid this panic, let's just skip doing GC on such
segment.

The bug is triggered with image reported in below link:

https://bugzilla.kernel.org/show_bug.cgi?id=200223

[  388.060262] ------------[ cut here ]------------
[  388.060268] kernel BUG at /home/y00370721/git/devf2fs/gc.c:989!
[  388.061172] invalid opcode: 0000 [#1] SMP
[  388.061773] Modules linked in: f2fs(O) bluetooth ecdh_generic xt_tcpudp iptable_filter ip_tables x_tables lp ttm drm_kms_helper drm intel_rapl sb_edac crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc aesni_intel fb_sys_fops ppdev aes_x86_64 syscopyarea crypto_simd sysfillrect parport_pc joydev sysimgblt glue_helper parport cryptd i2c_piix4 serio_raw mac_hid btrfs hid_generic usbhid hid raid6_pq psmouse pata_acpi floppy
[  388.064247] CPU: 7 PID: 4151 Comm: f2fs_gc-7:0 Tainted: G           O    4.13.0-rc1+ #26
[  388.065306] Hardware name: Xen HVM domU, BIOS 4.1.2_115-900.260_ 11/06/2015
[  388.066058] task: ffff880201583b80 task.stack: ffffc90004d7c000
[  388.069948] RIP: 0010:do_garbage_collect+0xcc8/0xcd0 [f2fs]
[  388.070766] RSP: 0018:ffffc90004d7fc68 EFLAGS: 00010202
[  388.071783] RAX: ffff8801ed227000 RBX: 0000000000000001 RCX: ffffea0007b489c0
[  388.072700] RDX: ffff880000000000 RSI: 0000000000000001 RDI: ffffea0007b489c0
[  388.073607] RBP: ffffc90004d7fd58 R08: 0000000000000003 R09: ffffea0007b489dc
[  388.074619] R10: 0000000000000000 R11: 0052782ab317138d R12: 0000000000000018
[  388.075625] R13: 0000000000000018 R14: ffff880211ceb000 R15: ffff880211ceb000
[  388.076687] FS:  0000000000000000(0000) GS:ffff880214fc0000(0000) knlGS:0000000000000000
[  388.083277] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  388.084536] CR2: 0000000000e18c60 CR3: 00000001ecf2e000 CR4: 00000000001406e0
[  388.085748] Call Trace:
[  388.086690]  ? find_next_bit+0xb/0x10
[  388.088091]  f2fs_gc+0x1a8/0x9d0 [f2fs]
[  388.088888]  ? lock_timer_base+0x7d/0xa0
[  388.090213]  ? try_to_del_timer_sync+0x44/0x60
[  388.091698]  gc_thread_func+0x342/0x4b0 [f2fs]
[  388.092892]  ? wait_woken+0x80/0x80
[  388.094098]  kthread+0x109/0x140
[  388.095010]  ? f2fs_gc+0x9d0/0x9d0 [f2fs]
[  388.096043]  ? kthread_park+0x60/0x60
[  388.097281]  ret_from_fork+0x25/0x30
[  388.098401] Code: ff ff 48 83 e8 01 48 89 44 24 58 e9 27 f8 ff ff 48 83 e8 01 e9 78 fc ff ff 48 8d 78 ff e9 17 fb ff ff 48 83 ef 01 e9 4d f4 ff ff <0f> 0b 66 0f 1f 44 00 00 0f 1f 44 00 00 55 48 89 e5 41 56 41 55
[  388.100864] RIP: do_garbage_collect+0xcc8/0xcd0 [f2fs] RSP: ffffc90004d7fc68
[  388.101810] ---[ end trace 81c73d6e6b7da61d ]---

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2018-07-28 18:26:08 -07:00
..
acl.c posix_acl: convert posix_acl.a_refcount from atomic_t to refcount_t 2018-01-02 19:27:28 -08:00
acl.h f2fs: remove dead code f2fs_check_acl 2016-09-14 16:52:36 -07:00
checkpoint.c f2fs: introduce and spread verify_blkaddr 2018-07-27 18:03:59 +09:00
data.c f2fs: introduce and spread verify_blkaddr 2018-07-27 18:03:59 +09:00
debug.c f2fs: Allocate and stat mem used by free nid bitmap more accurately 2018-07-28 18:23:26 -07:00
dir.c f2fs: clean up symbol namespace 2018-05-31 11:31:53 -07:00
extent_cache.c f2fs: clean up symbol namespace 2018-05-31 11:31:53 -07:00
f2fs.h f2fs: avoid the global name 'fault_name' 2018-07-28 18:26:08 -07:00
file.c f2fs: introduce and spread verify_blkaddr 2018-07-27 18:03:59 +09:00
gc.c f2fs: fix to skip GC if type in SSA and SIT is inconsistent 2018-07-28 18:26:08 -07:00
gc.h f2fs: introduce sbi->gc_mode to determine the policy 2018-05-31 11:31:51 -07:00
hash.c f2fs: check entire encrypted bigname when finding a dentry 2017-05-04 11:44:35 -04:00
inline.c f2fs: fix to do sanity check with reserved blkaddr of inline inode 2018-07-28 18:26:08 -07:00
inode.c f2fs: fix to do sanity check with node footer and iblocks 2018-07-28 18:26:06 -07:00
Kconfig fs/*/Kconfig: drop links to 404-compliant http://acl.bestbits.at 2018-01-01 12:45:37 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
namei.c f2fs: Replace strncpy with memcpy 2018-07-28 18:26:08 -07:00
node.c f2fs: try grabbing node page lock aggressively in sync scenario 2018-07-28 18:26:08 -07:00
node.h f2fs: support in-memory inode checksum when checking consistency 2018-07-27 18:03:59 +09:00
recovery.c f2fs: introduce and spread verify_blkaddr 2018-07-27 18:03:59 +09:00
segment.c f2fs: fix to correct return value of f2fs_trim_fs 2018-07-27 18:03:59 +09:00
segment.h f2fs: introduce and spread verify_blkaddr 2018-07-27 18:03:59 +09:00
shrinker.c f2fs: clean up symbol namespace 2018-05-31 11:31:53 -07:00
super.c f2fs: show the fsync_mode=nobarrier mount option 2018-07-28 18:26:08 -07:00
sysfs.c f2fs: avoid potential deadlock in f2fs_sbi_store 2018-07-27 18:03:59 +09:00
trace.c f2fs: fix potential hangtask in f2fs_trace_pid 2018-01-02 19:27:30 -08:00
trace.h f2fs: add sbi and page pointer in f2fs_io_info 2015-05-28 15:41:32 -07:00
xattr.c f2fs: clean up symbol namespace 2018-05-31 11:31:53 -07:00
xattr.h f2fs: guard macro variables with braces 2017-04-10 19:48:10 -07:00