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: 57905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp166689wrn; Wed, 15 Feb 2023 23:53:59 -0800 (PST) X-Google-Smtp-Source: AK7set+FdrXyxdpwjT1dJ/RrLqF0QbBQImA3FyaWsYOHDOWH6dvzq0ikhR0+pqZeLToQnEFVnAUJ X-Received: by 2002:a17:90a:f18b:b0:230:7a2b:da9b with SMTP id bv11-20020a17090af18b00b002307a2bda9bmr5787801pjb.34.1676534039066; Wed, 15 Feb 2023 23:53:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676534039; cv=none; d=google.com; s=arc-20160816; b=uWbash4LsPqjOy/zoGj2P1+BcjTyeCFfp3PFNnxsNzykDVLs1Y+60eGc/lvFq1jEDP BS8FDGLwjKSv4NlWzpLhvsYXGGN/dJ416f4rADyRp3Iz/F6t7D4p0qRboSaqesWB3PIt 3zJPO6DJmLiDK5159eiaubgqSnMCf88Dl1fj2tVjRlIUgurVdOy/RsePeqolbRyG3Zo4 xY+SfKA/suUuAJurJosEY/qea20njggOEhBibMNPuvBLOaKYlBCMghcQuDPmqaax7mbg F9CIHnfs2ToHFAZB98aOG8WWpXyzYhepr6adaKSSF/dmxwZKId728N9p1QPNxDJ6iFKP falg== 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=oEJl9mI2BPZgtqcU4ebRMNclNVoy/K+7rH+uFc8JogA=; b=e2ifQhE7oMP8wXakSuPs1/NUWHhSNs6oCXU/vV+cIM3GpdBDtvv6jremnukEBAAOng 8nkXmFbzaUgct1cw6l9kVokR66BHNdfqA7FZe+sTibMwNYqggAxiEjnKLWtzFWrQGRVe oJK6AWaqzbH5y+OV7uyU8cDu73VlTdHxsbtBQo6O3ZU+Hr0p+niLbZ35PsGokfyYvWE1 hAgGb8mgQRhtMxZTq//PAhx4fHks4mhQ2L4xtz0mpMJeFiBfGDChCMarQKAPyoDZHGzB S3SBRnJiPvLUdafuvuy8Ve43kKwkhbhes0Rd8Tf1Uljj7F/lKSU9a5Fp9Yi1ThbDhGGX FWlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="u/mdwkn6"; 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 d9-20020a17090a7bc900b00230a77cb5c7si780897pjl.153.2023.02.15.23.53.46; Wed, 15 Feb 2023 23:53:59 -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="u/mdwkn6"; 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 S229799AbjBPHog (ORCPT + 99 others); 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 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkk+LIzCtJLcpLzFFi42LZdljTQvfOvbfJBn/vslucnnqWyWJq+15G i+bF69ksnqyfxWxxaZG7xeVdc9gsFmx8xOjA7rFgU6nHplWdbB77565h99i94DOTx+dNcgGs Udk2GamJKalFCql5yfkpmXnptkrewfHO8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUBHKCmU JeaUAoUCEouLlfTtbIryS0tSFTLyi0tslVILUnIKzAv0ihNzi0vz0vXyUkusDA0MjEyBChOy M/a3b2UseMNW0bRvBXsD403WLkYODgkBE4l53fxdjFwcQgI7GCX6nnxmAonzCghK/N0hDGIK C9hI/L1h18XICVSiJHHtQC8LiC0soC+xefEydhCbTUBX4u+G5ewgY0QEJjNJTPiyggkkwSxQ JNE3+y9YkYQAr8SM9qcsELa0xPblWxkhbA2JH8t6mSFsUYmbq9+yw9jvj82HqhGRaL13FqpG UOLBz91QcUmJRYfOM0HY+RJ/V1xng7BrJLY2tEHF9SWudWwE28sr4CvRvXQZK4jNIqAqMWXe Sah7XCQu3/vCDnGzvMT2t3OYQX5nFtCUWL9LHxJSyhJHbrFAVPBJdBxG+GrHvCdQm9QkNm/a zAphy0hceNwGdaWHxKSt98AmCgkEStw6qDCBUWEWIphnIVk7C2HtAkbmVYxiqQXFuempxUYF RvCITc7P3cQITotabjsYp7z9oHeIkYmD8RCjBAezkgjvpptvkoV4UxIrq1KL8uOLSnNSiw8x mgI9PJFZSjQ5H5iY80riDU0sDUzMzAzNjUwNzJXEeaVtTyYLCaQnlqRmp6YWpBbB9DFxcEo1 MK2U/n1pR+4to4Jg+b64X0+eP6sJ3K2wb5vR9l1av1WupF1SYxfjVZ2w8ImePE97+sETH+P+ vs7/bbf44dSLOzeoiwg9So/ZFc1QNHn3uviTySfPL5jUtien4d6UYuvb1+zWdZyNFXnwmH3/ uZez5Rakhrw+6nVvr2ZO/r/tG5xO/E5/skPx973zGwymFE8qbjxive30m4lia7kW/u7KcXbb 66I/j3+TlRbDn4OJtZnT11Rf2HfYROik7/wZmWYHTiYk3vLamd604Of/Z9aTa2wTZpZXRe4O vP34hvq7DSfMhEUdvKovvJpWtXLPguLemTcMbz8NtP75kj1Md3/R9jldPnNdKqzytNx/WBit qXm6UomlOCPRUIu5qDgRANiXqR0UBAAA 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?1757973356670553570?= X-GMAIL-MSGID: =?utf-8?q?1757973356670553570?= 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;