From patchwork Thu Feb 16 07:44:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggil Song X-Patchwork-Id: 13142681 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B723CC636CC for ; Thu, 16 Feb 2023 07:44:54 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pSYwj-0002tI-KN; Thu, 16 Feb 2023 07:44:49 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pSYwe-0002tB-Py for linux-f2fs-devel@lists.sourceforge.net; Thu, 16 Feb 2023 07:44:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:Content-Type:Content-Transfer-Encoding: Date:Message-ID:CC:To:From:Sender:Reply-To:Subject:Mime-Version:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=oEJl9mI2BPZgtqcU4ebRMNclNVoy/K+7rH+uFc8JogA=; b=CXiibp0tLmrae3gi7p6gu/Qnm4 rjdAdG1mPLp1Iedr9cwvWcUdmHtaFX3I7JiCBvi19bbzaqQeTD3GRERnH3Fic8Z3X86FCrTDG25xj 5kyot6drcl5ZW2I30yJjUpQZlIFKM5M3vBCobV2z9zZmAXVWYxTAfV9VMHdsSvVnnqew=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:Content-Type:Content-Transfer-Encoding:Date:Message-ID:CC:To: From:Sender:Reply-To:Subject:Mime-Version:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=oEJl9mI2BPZgtqcU4ebRMNclNVoy/K+7rH+uFc8JogA=; b=j G80PDmX3jkB9Hu2LGktoYvBEil+r/FZb7bupLwM9SoJ8wiIdAgi8kyGBD4o/VO/P5K97vSuangnzv +PqwjjQWVqnyMO/J5mOv6QL9AjjY4sbJNygFQMXpxEpC3yCbFHF5GZYFYiCnmuNCSBWJ+nW68pIPO 1P52TvS505nh5sZk=; Received: from mailout4.samsung.com ([203.254.224.34]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pSYwa-0061IP-7g for linux-f2fs-devel@lists.sourceforge.net; Thu, 16 Feb 2023 07:44:44 +0000 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230216074429epoutp041a09ccf08fec22b082c60939f0954a84~EPk7IFdmC2800928009epoutp04w for ; Thu, 16 Feb 2023 07:44:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230216074429epoutp041a09ccf08fec22b082c60939f0954a84~EPk7IFdmC2800928009epoutp04w 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 From: Yonggil Song To: Chao Yu , "jaegeuk@kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , "daehojeong@google.com" 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 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkk+LIzCtJLcpLzFFi42LZdljTQvfOvbfJBn/vslucnnqWyWJq+15G i+bF69ksnqyfxWxxaZG7xeVdc9gsFmx8xOjA7rFgU6nHplWdbB77565h99i94DOTx+dNcg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Iu5qDgRANiXqR0UBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230215024850epcms2p22be2cc864d82b44f31c19a7ef28770b6 References: X-Headers-End: 1pSYwa-0061IP-7g Subject: [f2fs-dev] [PATCH v2] f2fs: fix uninitialized skipped_gc_rwsem X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: yonggil.song@samsung.com Cc: "gregkh@linuxfoundation.org" , "stable@vger.kernel.org" Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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;