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 4388B1DE8B4; Wed, 6 Nov 2024 12:16:16 +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=1730895377; cv=none; b=S+E4s5zjoS1OotbqDE9S3oZlNMB0Cao4AZEgVQFA7VhWzC5LyolVuPBbcosckjBqtarK3sM9ShjkGEaS2+O+9hX4qgAdt+6MVelFzAJVJLCoA2HjEyK5eo2J5bpfjPw5cjE7pTBTc27KJkZMhOCCzJG1LNGcW3uJBg9sN6lW5mI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730895377; c=relaxed/simple; bh=5KoTCkpdqpv0tcFSlVKAhJSBFnNWWksTqZmHVhwTvlk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sM3bMrwSHrVuXTihy/TkN5j1thsVQdH6ur6vfsb0/IFqVc8sZwa47F14cHXRC8QY//r5uDxCuCUOhv+trAxcS2BS4GJY6Vb20yXWTp2yvyjOitpdaHd1DNFOf4qMd1aPIgU4LgWhu7ky8A/4qr9MHhehA+59lcrNZ27u/Y7CDc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VO/OYmB8; 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="VO/OYmB8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77E8EC4CECD; Wed, 6 Nov 2024 12:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730895376; bh=5KoTCkpdqpv0tcFSlVKAhJSBFnNWWksTqZmHVhwTvlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VO/OYmB84CyQK0sOwbCBkV5UhNwyEg4ATiNBbKUFINRKKia4d/gqye4AMGzkTv9uQ LPpaao1RwFgT6e3RE96azzz05+TFGiz/tim/u8F+UE+tq0CCrljNEQ8BLX8eFaQv1e 6/niIAwOCYM6s7u2G0hKfajwdsCgkD2GktbYmwlU= 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 4.19 197/350] ocfs2: fix the la space leak when unmounting an ocfs2 volume Date: Wed, 6 Nov 2024 13:02:05 +0100 Message-ID: <20241106120325.835265196@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120320.865793091@linuxfoundation.org> References: <20241106120320.865793091@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 4.19-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 @@ -1026,6 +1026,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);