Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5928DC61DA4 for ; Thu, 16 Feb 2023 07:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbjBPH2a (ORCPT ); Thu, 16 Feb 2023 02:28:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjBPH22 (ORCPT ); Thu, 16 Feb 2023 02:28:28 -0500 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B508F38EB0 for ; Wed, 15 Feb 2023 23:28:25 -0800 (PST) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230216072823epoutp049ffb990d19a0e3ac7712c61e667c9a3d~EPW3fA87-1007910079epoutp04b for ; Thu, 16 Feb 2023 07:28:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230216072823epoutp049ffb990d19a0e3ac7712c61e667c9a3d~EPW3fA87-1007910079epoutp04b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1676532503; bh=/s/DDvoDqvkI0R3gCjxwHuxsXwGnIrRYiSsKEv400/g=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=L+RBRGvnQaZDCIqFx12dO+eKvjBFleHXqMZm9ndCCP4TxQ9HSjsHmq8Mo3PvNOwpC gKVJXSTVCiDWFrZX7PehW8lfrQevYFP/OqR1310pNQHXPgsiyUHKA/qE8sCMJpGDIH KkW/L3I76dqVRfcFV43QIRf1SeKGgQmS6UhFzN94= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230216072822epcas2p18e56acc255c73e58d7f98a47da295c2c~EPW3DGu_N1714217142epcas2p1K; Thu, 16 Feb 2023 07:28:22 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.69]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4PHRPf40ryz4x9Pr; Thu, 16 Feb 2023 07:28:22 +0000 (GMT) X-AuditID: b6c32a48-1f7ff70000021624-37-63eddb1648e5 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 0C.B8.05668.61BDDE36; Thu, 16 Feb 2023 16:28:22 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2] f2fs: fix uninitialized skipped_gc_rwsem Reply-To: yonggil.song@samsung.com Sender: Yonggil Song From: Yonggil Song To: Chao Yu , "jaegeuk@kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , "daehojeong@google.com" CC: "stable@vger.kernel.org" , "gregkh@linuxfoundation.org" , Seokhwan Kim , Daejun Park X-Priority: 3 X-Content-Kind-Code: NORMAL X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230216072821epcms2p35e1fecca382380723ac0031862687173@epcms2p3> Date: Thu, 16 Feb 2023 16:28:21 +0900 X-CMS-MailID: 20230216072821epcms2p35e1fecca382380723ac0031862687173 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAJsWRmVeSWpSXmKPExsWy7bCmqa7Y7bfJBqc3S1mcnnqWyWJq+15G i1UPwi2aF69ns3iyfhazxaVF7haXd81hs1iw8RFQrmMuowOnx4JNpR6bVnWyeeyfu4bdY/eC z0wefVtWMXp83iQXwB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dj+5Y9C1VYinOSDTUYi4qTgQAWdPf8SMEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230215024850epcms2p22be2cc864d82b44f31c19a7ef28770b6 References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When f2fs skipped a gc round during victim migration, there was a bug which would skip all upcoming gc rounds unconditionally because skipped_gc_rwsem was not initialized. It fixes the bug by correctly initializing the skipped_gc_rwsem inside the gc loop. Fixes: 3db1de0e582c ("f2fs: change the current atomic write way") Signed-off-by: Yonggil Song diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index b22f49a6f128..81d326abaac1 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1786,8 +1786,8 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) prefree_segments(sbi)); cpc.reason = __get_cp_reason(sbi); - sbi->skipped_gc_rwsem = 0; gc_more: + sbi->skipped_gc_rwsem = 0; if (unlikely(!(sbi->sb->s_flags & SB_ACTIVE))) { ret = -EINVAL; goto stop; -- 2.34.1