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 CCCD2C636CC for ; Thu, 16 Feb 2023 02:04:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229582AbjBPCCY (ORCPT ); Wed, 15 Feb 2023 21:02:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjBPCCW (ORCPT ); Wed, 15 Feb 2023 21:02:22 -0500 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C87829171 for ; Wed, 15 Feb 2023 18:02:19 -0800 (PST) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230216020215epoutp01cf4f17afb3142b3e891ad96c19a372b4~EK6HrWqhh2617526175epoutp01Z for ; Thu, 16 Feb 2023 02:02:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230216020215epoutp01cf4f17afb3142b3e891ad96c19a372b4~EK6HrWqhh2617526175epoutp01Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1676512935; bh=CSvqJjBL22C0lmgcM8zgoa8hVL77LICcIrvup4e0B1o=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=W55n6i4JpuqgbnUZhBDpWGQFqt+m9ugcBULO6ETKSLboUI6RXW9bk/TZWRpsq4JE2 Nr1Z6WPQrNHCwvY9jCcZC3YU4mbf/mo7PvvvJBoKEjnsg4+GEZLQB4JcqmWp5i4yxf kL8XfliaAVouEdRmOCshbS+MjgNptZS8B6sxgfEg= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230216020215epcas2p3be5de9975ecdc1198c5f7395f1a3bb8a~EK6HVWvAW3106531065epcas2p3x; Thu, 16 Feb 2023 02:02:15 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.91]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4PHJ9M0FH3z4x9Py; Thu, 16 Feb 2023 02:02:15 +0000 (GMT) X-AuditID: b6c32a45-671ff7000001f1e7-aa-63ed8ea624d5 Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 62.B3.61927.6AE8DE36; Thu, 16 Feb 2023 11:02:14 +0900 (KST) Mime-Version: 1.0 Subject: RE:(2) [PATCH v1] 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 In-Reply-To: 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: <20230216020214epcms2p1dfa8562c1d33231856848bb0ec8ba1a7@epcms2p1> Date: Thu, 16 Feb 2023 11:02:14 +0900 X-CMS-MailID: 20230216020214epcms2p1dfa8562c1d33231856848bb0ec8ba1a7 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFKsWRmVeSWpSXmKPExsWy7bCmme6yvrfJBisem1mcnnqWyWLVg3CL J+tnMVtcWuRucXnXHDaLVR1zGR3YPDat6mTz2L3gM5NH35ZVjB6fN8kFsERl22SkJqakFimk 5iXnp2TmpdsqeQ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ipzkg0 1GIuKk4EAK8lt+ENBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230215024850epcms2p22be2cc864d82b44f31c19a7ef28770b6 References: <20230215024850epcms2p22be2cc864d82b44f31c19a7ef28770b6@epcms2p2> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/2/15 10:48, Yonggil Song wrote: >> 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. > >It makes sense to me. > >> >> Fixes: d147ea4adb96 ("f2fs: introduce f2fs_gc_control to consolidate f2fs_gc parameters") > >How does this commits introduce the bug? Oh, sorry I've got wrong hash. I'll send right hash on PATCH v2. Thanks for your comment. > >Thanks, > >> 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;