From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B2F9168CF for ; Mon, 8 May 2023 11:12:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0184FC433D2; Mon, 8 May 2023 11:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1683544322; bh=0P9e1jtMpQ3Ujbw281sB3FwnIy2z61RQdz65lK+ZBfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vGAcJAI3CZlAWiU0Dl+r4nAfVnO7t+6BB3mofw3BJJOCiwL4F4wP6snzRIBgiIKaU ZQEfDaCLqGyA/rMb495uhVPQYVvqk7t9xg3u+jPnJSAct09FHUCt/P7+JVyfYZDhyx FR4ujgP2i91vv0dNW6k+dqh1Z+EgsPLMf1GVQ7ac= 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.3 372/694] f2fs: fix uninitialized skipped_gc_rwsem Date: Mon, 8 May 2023 11:43:27 +0200 Message-Id: <20230508094444.898599760@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230508094432.603705160@linuxfoundation.org> References: <20230508094432.603705160@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 0a9dfa4598606..292a17d62f569 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1791,8 +1791,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