From mboxrd@z Thu Jan 1 00:00:00 1970 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 B2776C77B75 for ; Mon, 8 May 2023 10:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234006AbjEHKEn (ORCPT ); Mon, 8 May 2023 06:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234004AbjEHKEm (ORCPT ); Mon, 8 May 2023 06:04:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2F0E30159 for ; Mon, 8 May 2023 03:04:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2060862310 for ; Mon, 8 May 2023 10:04:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33ACCC433EF; Mon, 8 May 2023 10:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1683540279; bh=tStkMQ6lfeqNfiLI0NZmx3bZzT/NOweDFNWzH7WYP5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zhdptwbpVhtkfKXrK38EIPUK6J+SbfFaagjZ2Dz4/EH+TKA6jcITDTGzgJJJmeLab rVs6LYfCXHvziUnqs2vdUIJM/401fufG6vR1Efjde9HaVdROpBkR7YQnX+cxV5+M6k OUIKdl1wpS2goTJ2yI5tAmv5x/6Qer291nR3ocA4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yonggil Song , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 6.1 304/611] f2fs: fix uninitialized skipped_gc_rwsem Date: Mon, 8 May 2023 11:42:26 +0200 Message-Id: <20230508094432.303471796@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230508094421.513073170@linuxfoundation.org> References: <20230508094421.513073170@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yonggil Song [ Upstream commit c17caf0ba3aa3411b96c71b4ce24be1040b8f3e8 ] 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: 6f8d4455060d ("f2fs: avoid fi->i_gc_rwsem[WRITE] lock in f2fs_gc") Signed-off-by: Yonggil Song Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index ee6836478efe6..aa928d1c81597 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1792,8 +1792,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; -- 2.39.2