From patchwork Thu Feb 16 07:28:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggil Song X-Patchwork-Id: 57899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp165711wrn; Wed, 15 Feb 2023 23:50:45 -0800 (PST) X-Google-Smtp-Source: AK7set+CbWwZc1T0T+r3T2vAH6yu1AT+xL34kVK/C2rbuvqo27qZ9JJytVx0ewC2LnHgncsnFdCz X-Received: by 2002:aa7:d48a:0:b0:4ac:bbd8:d04a with SMTP id b10-20020aa7d48a000000b004acbbd8d04amr4971568edr.5.1676533845208; Wed, 15 Feb 2023 23:50:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676533845; cv=none; d=google.com; s=arc-20160816; b=FZ327N/gWcj500XmpoyCSUutGfo5GBQkiabzcKF5bXUUAeo46rNSK1SsHL059V0FZF 9LyR1xNuVB/PaD5y5xFXVIzl/LI7vOCwNI2ljMAyhSm6EOHmjPWPlnVVOv7/Ymt/afHq ZEiKq/4aHd9L9TKg5kqD8GZVi1l0zel+iQZoGr46qso2p4JJLNQw//Y0SpFNtZCB8GPX 1UjJKlPXYw09H0m9WD1o+wRhonBqK03AdPpKgC8nXwUPlek3Zg42uqzW+LKFGzYBGFWJ trFvFk9U5vXslVmd6d1yntp+vecC5YGxnw9bvuFkGrMNHXDtHECo/e+FtigQxsAIXh3S Njhw== 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=ToQNtWs2jvuVAERWtUzO61mcjtvhL3vAElgk0LrEr9XjeHxIWoPC2VO1CbMq50NQNG QaZRQaVw9KQubXW8bhNvV2SlemAefJ01fYDgGvJjr8U9FkSHlIFiFpzNbB0Z7RitmaRW KmMZ+Z5dG1jzyMZxn26dTdD0sUqNkE0O+3E6M7YE5+WBjbeLQeJC6NEXrkUE86fm5lVa Snn+kTzr5T92oayHX7Dt0DWkCxaWlmVV9EERZvCpsT0c8OFvFEX+Ozhq4+iX+oqPRpJW GB2i6rQKNGH/XHB0mgPhdubuZqP1X5WKeTObZc7j/AKgciYNYleluJOCuBP2Z2S1VmhN sP/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=L+RBRGvn; 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 f2-20020a50ee82000000b004a0db601db8si1405273edr.619.2023.02.15.23.50.21; Wed, 15 Feb 2023 23:50:45 -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=L+RBRGvn; 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 S229646AbjBPH2a (ORCPT + 99 others); Thu, 16 Feb 2023 02:28:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjBPH22 (ORCPT ); Thu, 16 Feb 2023 02:28:28 -0500 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B508F38EB0 for ; Wed, 15 Feb 2023 23:28:25 -0800 (PST) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230216072823epoutp049ffb990d19a0e3ac7712c61e667c9a3d~EPW3fA87-1007910079epoutp04b for ; Thu, 16 Feb 2023 07:28:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230216072823epoutp049ffb990d19a0e3ac7712c61e667c9a3d~EPW3fA87-1007910079epoutp04b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1676532503; bh=/s/DDvoDqvkI0R3gCjxwHuxsXwGnIrRYiSsKEv400/g=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=L+RBRGvnQaZDCIqFx12dO+eKvjBFleHXqMZm9ndCCP4TxQ9HSjsHmq8Mo3PvNOwpC gKVJXSTVCiDWFrZX7PehW8lfrQevYFP/OqR1310pNQHXPgsiyUHKA/qE8sCMJpGDIH KkW/L3I76dqVRfcFV43QIRf1SeKGgQmS6UhFzN94= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230216072822epcas2p18e56acc255c73e58d7f98a47da295c2c~EPW3DGu_N1714217142epcas2p1K; Thu, 16 Feb 2023 07:28:22 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.69]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4PHRPf40ryz4x9Pr; Thu, 16 Feb 2023 07:28:22 +0000 (GMT) X-AuditID: b6c32a48-1f7ff70000021624-37-63eddb1648e5 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 0C.B8.05668.61BDDE36; Thu, 16 Feb 2023 16:28:22 +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" , 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: <20230216072821epcms2p35e1fecca382380723ac0031862687173@epcms2p3> Date: Thu, 16 Feb 2023 16:28:21 +0900 X-CMS-MailID: 20230216072821epcms2p35e1fecca382380723ac0031862687173 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAJsWRmVeSWpSXmKPExsWy7bCmqa7Y7bfJBqc3S1mcnnqWyWJq+15G i1UPwi2aF69ns3iyfhazxaVF7haXd81hs1iw8RFQrmMuowOnx4JNpR6bVnWyeeyfu4bdY/eC z0wefVtWMXp83iQXwBaVbZORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtq q+TiE6DrlpkDdJKSQlliTilQKCCxuFhJ386mKL+0JFUhI7+4xFYptSAlp8C8QK84Mbe4NC9d Ly+1xMrQwMDIFKgwITvj2JaprAUX2CombspsYDzA2sXIySEhYCJxesF3pi5GLg4hgR2MEjen LwNKcHDwCghK/N0hDGIKC9hI/L1hB1IuJKAkce1ALwuILSygL7F58TJ2EJtNQFfi74bl7CBj RAQmM0lM+LKCCSTBLHCIUWLHZ0aIXbwSM9qfskDY0hLbl2+FimtI/FjWywxhi0rcXP2WHcZ+ f2w+VI2IROu9s1A1ghIPfu6GiktKLDp0ngnCzpf4u+I6G4RdI7G1oQ0qri9xrWMj2F5eAV+J q2vfgcVZBFQl/ny/D1XjIrFw9j8WiJvlJba/ncMM8juzgKbE+l36IKaEgLLEkVtQFXwSHYf/ ssN8tWPeE6gpahKbN22GhqyMxIXHbVBXekhM2nqPGRKEgRKP+t+yT2BUmIUI51lI9s5C2LuA kXkVo1hqQXFuemqxUYEJPGaT83M3MYKTppbHDsbZbz/oHWJk4mAEBjYHs5II76abb5KFeFMS K6tSi/Lji0pzUosPMZoCfTyRWUo0OR+YtvNK4g1NLA1MzMwMzY1MDcyVxHmlbU8mCwmkJ5ak ZqemFqQWwfQxcXBKNTApx7Bl3Hp33MXZ+mojW/TPk9y2Sd9b676t2q8ntKnl8dTSL2oPD9jZ HLmtpVoeftRX9ebsxy4uzx4577j0J2yaece0z0zSHJ9q+54kWdfrLzNunsrU+UDyxz8Xzwn9 GR9umB+pSuaqWnNFarJB6lfH1e7RRssDHu47dH9rzP+4ib51tpE1px/7S/iJeDx7HitqNbtw 6qRKn8yjN6Q+nVQ8fOcWH/e6/m9PTrYomB3KitaNiGffdMjyV4lH3KPodxPW9UpPWOHZzZjN rfAnaoHH+0T3RXULD2zrOxSdfkO7hU1Sgvnrrkfbl7kuuFZh8crU0z4k0uTPvQPu4f+lFxby HL/D+vbJvcBdj+5Y9C1VYinOSDTUYi4qTgQAWdPf8SMEAAA= 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?1757954955942320322?= X-GMAIL-MSGID: =?utf-8?q?1757973153198516678?= 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 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;