From: Sasha Levin <Alexander.Levin@microsoft.com>
To: "stable@vger.kernel.org" <stable@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Chao Yu <yuchao0@huawei.com>, Jaegeuk Kim <jaegeuk@kernel.org>,
Sasha Levin <Alexander.Levin@microsoft.com>
Subject: [PATCH AUTOSEL 4.9 32/62] f2fs: fix to skip GC if type in SSA and SIT is inconsistent
Date: Sun, 2 Sep 2018 13:14:44 +0000 [thread overview]
Message-ID: <20180902131411.183978-22-alexander.levin@microsoft.com> (raw)
In-Reply-To: <20180902131411.183978-1-alexander.levin@microsoft.com>
From: Chao Yu <yuchao0@huawei.com>
[ Upstream commit 10d255c3540239c7920f52d2eb223756e186af56 ]
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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
---
fs/f2fs/gc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index ad4dfd29d923..759056e776e5 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -877,7 +877,13 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
goto next;
sum = page_address(sum_page);
- f2fs_bug_on(sbi, type != GET_SUM_TYPE((&sum->footer)));
+ if (type != GET_SUM_TYPE((&sum->footer))) {
+ f2fs_msg(sbi->sb, KERN_ERR, "Inconsistent segment (%u) "
+ "type [%d, %d] in SSA and SIT",
+ segno, type, GET_SUM_TYPE((&sum->footer)));
+ set_sbi_flag(sbi, SBI_NEED_FSCK);
+ goto next;
+ }
/*
* this is to avoid deadlock:
--
2.17.1
next prev parent reply other threads:[~2018-09-02 17:30 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-02 13:14 [PATCH AUTOSEL 4.9 11/62] uio: potential double frees if __uio_register_device() fails Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 12/62] tty: rocket: Fix possible buffer overwrite on register_PCI Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 13/62] f2fs: do not set free of current section Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 14/62] perf tools: Allow overriding MAX_NR_CPUS at compile time Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 15/62] NFSv4.0 fix client reference leak in callback Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 16/62] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 17/62] macintosh/via-pmu: Add missing mmio accessors Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 18/62] ath9k: report tx status on EOSP Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 19/62] ath9k_hw: fix channel maximum power level test Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 20/62] ath10k: prevent active scans on potential unusable channels Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 21/62] wlcore: Set rx_status boottime_ns field on rx Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 22/62] MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 23/62] ata: libahci: Correct setting of DEVSLP register Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 24/62] scsi: 3ware: fix return 0 on the error path of probe Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 25/62] ath10k: disable bundle mgmt tx completion event support Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 26/62] Bluetooth: hidp: Fix handling of strncpy for hid->name information Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 27/62] x86/mm: Remove in_nmi() warning from vmalloc_fault() Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 28/62] x86/kexec: Allocate 8k PGDs for PTI Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 29/62] gpio: ml-ioh: Fix buffer underwrite on probe error path Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 30/62] net: mvneta: fix mtu change on port without link Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 31/62] f2fs: try grabbing node page lock aggressively in sync scenario Sasha Levin
2018-09-02 13:14 ` Sasha Levin [this message]
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 33/62] tpm_tis_spi: Pass the SPI IRQ down to the driver Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 34/62] tpm/tpm_i2c_infineon: switch to i2c_lock_bus(..., I2C_LOCK_SEGMENT) Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 35/62] f2fs: fix to do sanity check with reserved blkaddr of inline inode Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 36/62] MIPS: Octeon: add missing of_node_put() Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 37/62] MIPS: generic: fix " Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 38/62] iio: ad9523: Fix return value for ad952x_store() Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 39/62] net: dcb: For wild-card lookups, use priority -1, not 0 Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 40/62] Input: atmel_mxt_ts - only use first T9 instance Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 41/62] iommu/dma: Respect bus DMA limit for IOVAs Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 42/62] media: s5p-mfc: Fix buffer look up in s5p_mfc_handle_frame_{new, copy_time} functions Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 43/62] partitions/aix: append null character to print data from disk Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 44/62] partitions/aix: fix usage of uninitialized lv_info and lvname structures Sasha Levin
2018-09-02 13:14 ` [PATCH AUTOSEL 4.9 45/62] media: helene: fix xtal frequency setting at power on Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 46/62] f2fs: Fix uninitialized return in f2fs_ioc_shutdown() Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 47/62] media: em28xx: Fix DualHD disconnect oops Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 48/62] iommu/ipmmu-vmsa: Fix allocation in atomic context Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 49/62] mfd: ti_am335x_tscadc: Fix struct clk memory leak Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 50/62] f2fs: fix to do sanity check with {sit,nat}_ver_bitmap_bytesize Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 51/62] ALSA: riptide: Properly endian notations Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 52/62] ALSA: wss: Fix sparse warning wrt PCM format type Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 53/62] ALSA: sb: Fix PCM format bit calculation Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 54/62] ALSA: asihpi: Fix PCM format notations Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 55/62] ALSA: ad1816a: Fix sparse warning wrt PCM format type Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 56/62] ALSA: hda: Fix implicit PCM format type conversion Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 57/62] ALSA: au88x0: Fix sparse warning wrt PCM format type Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 58/62] ALSA: sb: " Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 59/62] NFSv4.1: Fix a potential layoutget/layoutrecall deadlock Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 60/62] MIPS: WARN_ON invalid DMA cache maintenance, not BUG_ON Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 61/62] RDMA/cma: Do not ignore net namespace for unbound cm_id Sasha Levin
2018-09-02 13:15 ` [PATCH AUTOSEL 4.9 62/62] fuse: Add missed unlock_page() to fuse_readpages_fill() Sasha Levin
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=20180902131411.183978-22-alexander.levin@microsoft.com \
--to=alexander.levin@microsoft.com \
--cc=jaegeuk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yuchao0@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).