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 DE71E17DFF7; Tue, 8 Oct 2024 12:30:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728390656; cv=none; b=ZBSjFBv8Nau5S9C5/NTjsWQDnUUy9hOqAWDyA5g9uZUAdUkxnWaX0gG8fDVuBq21i/QjTLJ8L20fHooBJJrso+7PG3kbEDvlapUJIqYFuJt2OBbZNsZZn2JznZJ7y1QoEX9asXJf3jEe6cnGfhxd9QFPYQewEXkYJ38/dLRI8pw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728390656; c=relaxed/simple; bh=H/mDiq290s2QWgx254iFE6Te5G8p0nvuk14RuDowFFQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cTSX4Jcz9rhWqS4gD8B8n11uyj19yum26LotgbvqsoC/MrSsdEEsagr7ao404zr9aY5WG6prrgWhBLdZfnhZzbPzIlLJB8P92ZMtYPgSjYXT66GpQa0HtQLqdP5x/9ZhaaZE+JiDQDWk4KnT36WubMkpGVnFp0HU3BWr1ryylBI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TqwpHkO4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TqwpHkO4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52401C4CEC7; Tue, 8 Oct 2024 12:30:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728390655; bh=H/mDiq290s2QWgx254iFE6Te5G8p0nvuk14RuDowFFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TqwpHkO4l5h/aOMqD7W1SYMZWV8/FrGEgDNQg6C7W+95RnoKRDUlmZGkyNtfmTewS xNBu8EHHj6fekXSsKpy583rwVQwa7ubCMChNUzO7vzcDRrH0BWs21QtixExltKrpiV ZwphZ8d7asLHo9U3M4eNCQM/aYq1JSH0rdwO8D8M= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Heming Zhao , Su Yue , Joseph Qi , Mark Fasheh , Joel Becker , Junxiao Bi , Changwei Ge , Gang He , Jun Piao , Andrew Morton Subject: [PATCH 6.10 352/482] ocfs2: fix the la space leak when unmounting an ocfs2 volume Date: Tue, 8 Oct 2024 14:06:55 +0200 Message-ID: <20241008115702.276963006@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115648.280954295@linuxfoundation.org> References: <20241008115648.280954295@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Heming Zhao commit dfe6c5692fb525e5e90cefe306ee0dffae13d35f upstream. This bug has existed since the initial OCFS2 code. The code logic in ocfs2_sync_local_to_main() is wrong, as it ignores the last contiguous free bits, which causes an OCFS2 volume to lose the last free clusters of LA window on each umount command. Link: https://lkml.kernel.org/r/20240719114310.14245-1-heming.zhao@suse.com Signed-off-by: Heming Zhao Reviewed-by: Su Yue Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Gang He Cc: Jun Piao Cc: Heming Zhao Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/ocfs2/localalloc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c @@ -1002,6 +1002,25 @@ static int ocfs2_sync_local_to_main(stru start = bit_off + 1; } + /* clear the contiguous bits until the end boundary */ + if (count) { + blkno = la_start_blk + + ocfs2_clusters_to_blocks(osb->sb, + start - count); + + trace_ocfs2_sync_local_to_main_free( + count, start - count, + (unsigned long long)la_start_blk, + (unsigned long long)blkno); + + status = ocfs2_release_clusters(handle, + main_bm_inode, + main_bm_bh, blkno, + count); + if (status < 0) + mlog_errno(status); + } + bail: if (status) mlog_errno(status);