From patchwork Wed Feb 15 02:48:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggil Song X-Patchwork-Id: 13141246 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 81091C05027 for ; Wed, 15 Feb 2023 02:49:12 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pS7r4-0000jl-Ay; Wed, 15 Feb 2023 02:49:09 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pS7r2-0000jf-TJ for linux-f2fs-devel@lists.sourceforge.net; Wed, 15 Feb 2023 02:49:08 +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=WBBMh11k+5k+trQqfhsCGIiCubTA7xgMqB9364lgdrs=; b=WY1/sCpThvKEUL0FhZ5t9S9HQv /LQ0E6mlcrAm0HbjqDNt08y+9Z9zjFU9KkeSlnPdCjt67TKhKUVD2kDAhtGCOCj0RqQOwyuNJToks bh7k0Mih/0MJD4uFzFkybveRKnjI3fsb0HEQlvAV8cjiQwSwqWkfh2LGdjbp8l9Dow5A=; 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=WBBMh11k+5k+trQqfhsCGIiCubTA7xgMqB9364lgdrs=; b=D sH4LKalvdKann+PYwRtwOkKk4vh18s6HVkTDewgYcvpcPDlOy5jo+AiHKr3Kmg/MiBcBfnoe2ngAO D91Qc3dwBEcOk+qN9SoY9Ucc+mD/csnO1naOPOMaSuwmIbSWNBFb/j59vjP4jF4NO6NsMCXGGJhgq +bkqEuDLSUBGXWkc=; Received: from mailout1.samsung.com ([203.254.224.24]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pS7qv-0004g1-1R for linux-f2fs-devel@lists.sourceforge.net; Wed, 15 Feb 2023 02:49:08 +0000 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230215024851epoutp01e007812fd2bd97280e063b7d9ad2c388~D35hgBQVs1625816258epoutp01P for ; Wed, 15 Feb 2023 02:48:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230215024851epoutp01e007812fd2bd97280e063b7d9ad2c388~D35hgBQVs1625816258epoutp01P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1676429331; bh=WBBMh11k+5k+trQqfhsCGIiCubTA7xgMqB9364lgdrs=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=liNxrF0aVnd/iaPaj38Nn3N/k2G6HTrz8wt2BDoqSJcfrLwMEwG045diS7RGhvrxC R4jVHWpIb1EFhh4n6yASjyBg51KBZIYlaJaCaCuAw9DiiP//iOwqHf6dC7Cr008wy6 dKw1a0LjKfM3XOjyCc63ptXbxjOSOFfElIbZlOrc= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230215024851epcas2p1f721c7342ecb6dc5a28c0b732bbe6d64~D35g-T9mH1382613826epcas2p1-; Wed, 15 Feb 2023 02:48:51 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.88]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4PGjFZ756Rz4x9Px; Wed, 15 Feb 2023 02:48:50 +0000 (GMT) X-AuditID: b6c32a46-cee5fa8000007a4b-57-63ec48127d0c Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id A7.56.31307.2184CE36; Wed, 15 Feb 2023 11:48:50 +0900 (KST) Mime-Version: 1.0 From: Yonggil Song To: "jaegeuk@kernel.org" , "chao@kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.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: <20230215024850epcms2p22be2cc864d82b44f31c19a7ef28770b6@epcms2p2> Date: Wed, 15 Feb 2023 11:48:50 +0900 X-CMS-MailID: 20230215024850epcms2p22be2cc864d82b44f31c19a7ef28770b6 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLKsWRmVeSWpSXmKPExsWy7bCmha6Qx5tkg8VdVhanp55lslj1INzi yfpZzBaXFrlbXN41h81iVcdcRoup548wObB7bFrVyeaxe8FnJo++LasYPT5vkgtgicq2yUhN TEktU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F9My+cFSizFGYmG WsxFxYkAqa50JxAEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230215024850epcms2p22be2cc864d82b44f31c19a7ef28770b6 References: X-Headers-End: 1pS7qv-0004g1-1R Subject: [f2fs-dev] [PATCH v1] 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: Seokhwan Kim 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: d147ea4adb96 ("f2fs: introduce f2fs_gc_control to consolidate f2fs_gc parameters") 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;