From patchwork Thu Feb 16 07:13: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: 57890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp158646wrn; Wed, 15 Feb 2023 23:28:44 -0800 (PST) X-Google-Smtp-Source: AK7set9cFRraOp58YIRUuciA+whviYBUt4bu7DqLtMexU51e5y5e1O13uazNC3+tIEkfOC8ziVAg X-Received: by 2002:a17:90a:86c1:b0:234:67ef:304b with SMTP id y1-20020a17090a86c100b0023467ef304bmr4660565pjv.37.1676532523917; Wed, 15 Feb 2023 23:28:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676532523; cv=none; d=google.com; s=arc-20160816; b=uMdC4ekJw2Y4mh6wDLDH6cdD8MGrutgzRIoE+O67lotXXw2xd5nmXRdQ1miaGjgLmW gKhW1pOmJ7JEWGb8L4VNCYWRExBtUaYn4NJxXlHIUmhfXDmgLPdcboDJM8EvFEibgYeO eG5Q/+meXCf/EUn3DjP0dqDhNo8C+AsBip7lHrxvrEOCICb1bCeZ4sA09Mqt3W3qfPML y09My34rPFGAim2QjUDTA+GX7mirz9Ijln5BWr6vZWx7/lCBy4VODXJ1o1qQUdkjvZTy 4SuRBMhVLTWJc/NXgoBdoPzji3Qqkz5r5msFb8ga4EGS28xaQqOZGb6oE9GhQiJtnEMH cRyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:cc:to:from:sender :reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=/s/DDvoDqvkI0R3gCjxwHuxsXwGnIrRYiSsKEv400/g=; b=MTuMYIZ62zi1t6gn+NAJ8zu32caC34r615mORFUw/Acq5rSf/YGBCSdF127ufl265S +OtNhwHqU1dgvbRqM2j3irXqRTS1kbGU2EOH3uehO6sKdz4tQ2RTFsPv7Ggim6l+jCQw E1WzExlgJNe1++5VZrk9ZTlbcHT3/qp0n+yQAfUUFgdbrMQyGHN2Uaha6MSS5l9FH2MC 59jhV32FcyscrRQzIsjHVmo7qGd55zwCbNvQ2ruHXjpLSmmtFDyhQ8u4QGLaG+UfT4HC At/UCCmkZ+1WCFI0tdddh5wsHdt+fi1/2dpkBm1hMxnKEcVKQ7Qw0QMrjUtPaHsAeuX3 toHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=FhlJk2fQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a170902e54f00b001949482830esi827853plf.414.2023.02.15.23.28.30; Wed, 15 Feb 2023 23:28:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=FhlJk2fQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229762AbjBPHN4 (ORCPT + 99 others); Thu, 16 Feb 2023 02:13:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbjBPHNz (ORCPT ); Thu, 16 Feb 2023 02:13:55 -0500 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19B96298EB for ; Wed, 15 Feb 2023 23:13:54 -0800 (PST) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230216071351epoutp01a7cd18fb076a64d7b11ad0f2d6d3db3b~EPKLRgqTq2543725437epoutp01u for ; Thu, 16 Feb 2023 07:13:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230216071351epoutp01a7cd18fb076a64d7b11ad0f2d6d3db3b~EPKLRgqTq2543725437epoutp01u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1676531631; bh=/s/DDvoDqvkI0R3gCjxwHuxsXwGnIrRYiSsKEv400/g=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=FhlJk2fQEkFwbFsZXf/SP5bxhpxj20U0tOp1zytWzChCqAhZxfJ5atiN3bjDK6NWx O+ZR1Ekz3C72i4AOihqi2VENhHkxY7p26T76yFZ9E9dSr9J8iN+hTaYbGVlGM9L6/o pBzO891OAl0/xhFWqUO8ns39kyUlurlcXX0IrFk4= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230216071351epcas2p1e45a30e991e440d87e949dd5415eb736~EPKLCWZSp2317123171epcas2p1W; Thu, 16 Feb 2023 07:13:51 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.101]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4PHR4t4fYMz4x9Pv; Thu, 16 Feb 2023 07:13:50 +0000 (GMT) X-AuditID: b6c32a46-4e1ff70000007a4b-c9-63edd7ae7059 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id A1.79.31307.EA7DDE36; Thu, 16 Feb 2023 16:13:50 +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: 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: <20230216071350epcms2p7b3f5f37b168b634ec7a7ba8555fd0b49@epcms2p7> Date: Thu, 16 Feb 2023 16:13:50 +0900 X-CMS-MailID: 20230216071350epcms2p7b3f5f37b168b634ec7a7ba8555fd0b49 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPKsWRmVeSWpSXmKPExsWy7bCmqe6662+TDV4tk7c4PfUsk8XU9r2M FqsehFs8WT+L2eLSIneLy7vmsFms6pjL6MDusWBTqcemVZ1sHrsXfGby6NuyitHj8ya5ANao bJuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wcoBuUFMoS c0qBQgGJxcVK+nY2RfmlJakKGfnFJbZKqQUpOQXmBXrFibnFpXnpenmpJVaGBgZGpkCFCdkZ x7ZMZS24wFYxcVNmA+MB1i5GTg4JAROJFQ9OMYPYQgI7GCWerdLtYuTg4BUQlPi7QxjEFBaw kfh7ww6iQkni2oFeFhBbWEBfYvPiZewgNpuArsTfDcuBbC4OEYHJTBITvqxgAkkwCwRJ3J/y AGoVr8SM9qcsELa0xPblWxkhbA2JH8t6mSFsUYmbq9+yw9jvj82HqhGRaL13FqpGUOLBz91Q cUmJRYfOM0HY+RJ/V1xng7BrJLY2tEHF9SWudWxkgXjLV+LqGSuQMIuAqsTsBb+hSlwkmu8+ hTpZXmL72znMIOXMApoS63fpg5gSAsoSR26xQFTwSXQc/ssO89SOeU+gpqhJbN60GepZGYkL j9ugjvSQmLT1HjSMAyWm7jvAPoFRYRYimGch2TsLYe8CRuZVjGKpBcW56anFRgVG8HhNzs/d xAhOiVpuOxinvP2gd4iRiYPxEKMEB7OSCO+mm2+ShXhTEiurUovy44tKc1KLDzGaAn08kVlK NDkfmJTzSuINTSwNTMzMDM2NTA3MlcR5pW1PJgsJpCeWpGanphakFsH0MXFwSjUwbbu3JNvq KZ+X1pWV15Z6637eptVkbG/+Mt4japLohcrJa8q/yRtcfem03djo1JWQb2t/PThbk9y74+yd QteNs+ImzvjWeHHNe2GxZ/PWCOm2lvMvqDk54+5DZZEKN7dnLn7z1R8dbJ/V1C63mYV7Ts5H nofdz2Vbqi9mNP9ZLnUpxmtW4qcknhn1237N9JwgfmL2+eJ3savuezRsbH857/OGVUc3nljS 2L5G9eAl3/CPvSU23xT7C3p+f4o78MHoUtuKK1uPL02MqGFzLvjLpZLsuHKL8kXnSSvuXAm0 qnad73jzY06XpkVi2ayWy+Kic87Jv5n1iHPusrkBWWziluIm2sERtpcL/4QmOy9dNVOJpTgj 0VCLuag4EQCs9AkAEgQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230215024850epcms2p22be2cc864d82b44f31c19a7ef28770b6 References: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757971767605252293?= X-GMAIL-MSGID: =?utf-8?q?1757971767605252293?= 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 Reviewed-by: Chao Yu 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;