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 D8528C636CC for ; Thu, 16 Feb 2023 02:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbjBPC5y (ORCPT ); Wed, 15 Feb 2023 21:57:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjBPC5w (ORCPT ); Wed, 15 Feb 2023 21:57:52 -0500 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D6FDF4 for ; Wed, 15 Feb 2023 18:57:48 -0800 (PST) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230216025745epoutp04c3521f878868160756186d6dcf9a2ef9~ELqksWoSQ1578415784epoutp04f for ; Thu, 16 Feb 2023 02:57:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230216025745epoutp04c3521f878868160756186d6dcf9a2ef9~ELqksWoSQ1578415784epoutp04f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1676516265; bh=/s/DDvoDqvkI0R3gCjxwHuxsXwGnIrRYiSsKEv400/g=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=W2q1n7vZLO/mbYv4g3UpVezQkggl/3F2/vZo/HI5ICNQ/YeigJCiqrbPcNTzNHTwo AvvmCafZJIesovoBrtsCwIwK5qQ1pkh6OAWhn1LIUDN4syVzwAxaHvRdDfF9eGXcBK gEOAGYa1NPF5ZfRz9St0Acuv57bR4DP40OzQrEbc= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230216025745epcas2p33d13ec8159efa85b6bf194c6f3d6a379~ELqkatBD21025710257epcas2p3e; Thu, 16 Feb 2023 02:57:45 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.98]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4PHKPN5kszz4x9Pw; Thu, 16 Feb 2023 02:57:44 +0000 (GMT) X-AuditID: b6c32a46-4e1ff70000007a4b-23-63ed9ba80101 Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id B6.2C.31307.8AB9DE36; Thu, 16 Feb 2023 11:57:44 +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" 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: <20230216025743epcms2p31d1bde5cfb315d13231010b0a46fbec4@epcms2p3> Date: Thu, 16 Feb 2023 11:57:43 +0900 X-CMS-MailID: 20230216025743epcms2p31d1bde5cfb315d13231010b0a46fbec4 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOKsWRmVeSWpSXmKPExsWy7bCmme6K2W+TDf6161ucnnqWyWLVg3CL J+tnMVtcWuRucXnXHDaLVR1zGR3YPDat6mTz2L3gM5NH35ZVjB6fN8kFsERl22SkJqakFimk 5iXnp2TmpdsqeQfHO8ebmhkY6hpaWpgrKeQl5qbaKrn4BOi6ZeYAr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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