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 389F0C61DA4 for ; Thu, 16 Feb 2023 07:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229768AbjBPHN5 (ORCPT ); Thu, 16 Feb 2023 02:13:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbjBPHNz (ORCPT ); Thu, 16 Feb 2023 02:13:55 -0500 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19B96298EB for ; Wed, 15 Feb 2023 23:13:54 -0800 (PST) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230216071351epoutp01a7cd18fb076a64d7b11ad0f2d6d3db3b~EPKLRgqTq2543725437epoutp01u for ; Thu, 16 Feb 2023 07:13:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230216071351epoutp01a7cd18fb076a64d7b11ad0f2d6d3db3b~EPKLRgqTq2543725437epoutp01u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1676531631; bh=/s/DDvoDqvkI0R3gCjxwHuxsXwGnIrRYiSsKEv400/g=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=FhlJk2fQEkFwbFsZXf/SP5bxhpxj20U0tOp1zytWzChCqAhZxfJ5atiN3bjDK6NWx O+ZR1Ekz3C72i4AOihqi2VENhHkxY7p26T76yFZ9E9dSr9J8iN+hTaYbGVlGM9L6/o pBzO891OAl0/xhFWqUO8ns39kyUlurlcXX0IrFk4= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230216071351epcas2p1e45a30e991e440d87e949dd5415eb736~EPKLCWZSp2317123171epcas2p1W; Thu, 16 Feb 2023 07:13:51 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.101]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4PHR4t4fYMz4x9Pv; Thu, 16 Feb 2023 07:13:50 +0000 (GMT) X-AuditID: b6c32a46-4e1ff70000007a4b-c9-63edd7ae7059 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id A1.79.31307.EA7DDE36; Thu, 16 Feb 2023 16:13:50 +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: 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: <20230216071350epcms2p7b3f5f37b168b634ec7a7ba8555fd0b49@epcms2p7> Date: Thu, 16 Feb 2023 16:13:50 +0900 X-CMS-MailID: 20230216071350epcms2p7b3f5f37b168b634ec7a7ba8555fd0b49 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPKsWRmVeSWpSXmKPExsWy7bCmqe6662+TDV4tk7c4PfUsk8XU9r2M FqsehFs8WT+L2eLSIneLy7vmsFms6pjL6MDusWBTqcemVZ1sHrsXfGby6NuyitHj8ya5ANao bJuM1MSU1CKF1Lzk/JTMvHR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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