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 AEB8CC636CC for ; Thu, 16 Feb 2023 07:44:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229637AbjBPHog (ORCPT ); Thu, 16 Feb 2023 02:44:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbjBPHod (ORCPT ); Thu, 16 Feb 2023 02:44:33 -0500 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AE743B0C8 for ; Wed, 15 Feb 2023 23:44:31 -0800 (PST) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230216074429epoutp01afd7589a044142d3b2d6febbbdc9c15e~EPk7R3iby2123921239epoutp01g for ; Thu, 16 Feb 2023 07:44:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230216074429epoutp01afd7589a044142d3b2d6febbbdc9c15e~EPk7R3iby2123921239epoutp01g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1676533469; bh=oEJl9mI2BPZgtqcU4ebRMNclNVoy/K+7rH+uFc8JogA=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=u/mdwkn69McCwBKe+B0gOHcSguDuCTw0QDDR9kca5fgTEUk3R5b4X2XuCI37K06Od BFcAFtNuU8bfielerD+TPNPhCzPnPBSy5mI5bVNAlWRM0Hx6ttgCGnqoZcJU9TJH3X S87HvRIgFjdcBkcxtfhvGgOt6Oeqza5uYLsf96ZQ= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230216074428epcas2p14a2330c2d00e8976848f16f37027ceff~EPk6eeJuO0558405584epcas2p1s; Thu, 16 Feb 2023 07:44:28 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.97]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4PHRmD2K6Bz4x9QB; Thu, 16 Feb 2023 07:44:28 +0000 (GMT) X-AuditID: b6c32a46-743fa70000007a4b-af-63eddedc5314 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 90.8D.31307.CDEDDE36; Thu, 16 Feb 2023 16:44:28 +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" 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: <20230216074427epcms2p49a3d71b08d356530b40e34e750cc2366@epcms2p4> Date: Thu, 16 Feb 2023 16:44:27 +0900 X-CMS-MailID: 20230216074427epcms2p49a3d71b08d356530b40e34e750cc2366 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkk+LIzCtJLcpLzFFi42LZdljTQvfOvbfJBn/vslucnnqWyWJq+15G i+bF69ksnqyfxWxxaZG7xeVdc9gsFmx8xOjA7rFgU6nHplWdbB77565h99i94DOTx+dNcgGs Udk2GamJKalFCql5yfkpmXnptkrewfHO8aZmBoa6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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") Cc: stable@vger.kernel.org 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