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 DF0881D5143; Tue, 15 Oct 2024 13:15:22 +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=1728998123; cv=none; b=g5i4TTanlPgd26NeHWLHmo3GO8HkJpQAP7jpKGhtDiLE/OCfCp9dT2wcF+IWCfRixmrzm8kCpCNm5L+ZYaNC3m5ITvzN7BzgDsRi9DWQoUQJaVjzyruftIoF5tHRbWcnrcvvwngJfGiT9ksHvTZ4mUpuJ9m2ct+u/NMas2u/ztg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998123; c=relaxed/simple; bh=/K81bsyQRpYxEcDCB8megILoBBi83qF3FuPtUC6Lv6U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gxH6gahaVgE1+jWY//UAqi1XP1d9jUeM9Mxrag/KrsdKPTswuIC50RsHDgw+YIPztseJ36hi8o7roOszS6RcL7+L0n4yNo+mmCPvRCIVfN6vcESX2oxjlHJ8nEd98drkZZ6CV27x9lCdQ9OzwZA6Z1bpRzqhOp/aV+lN8cqH2L8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=q66mI698; 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="q66mI698" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E0F9C4CEC6; Tue, 15 Oct 2024 13:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728998122; bh=/K81bsyQRpYxEcDCB8megILoBBi83qF3FuPtUC6Lv6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q66mI698mGqaLHgu1FTKxmMxqhqFp4hhLvrmVdx1fuSnYgQs+h0eMQP8YQfXgEqiE y5dKM5whWPtl0FbZtyJNOgAo6gOhtzLXcEXICYEKZqrZVft3HREzTE+EhTJVVvyJZV Wp31FvZZaGrEKJGjVUg2thZB+N4Lgz3IhtOzqCUI= 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 5.10 386/518] ocfs2: fix the la space leak when unmounting an ocfs2 volume Date: Tue, 15 Oct 2024 14:44:50 +0200 Message-ID: <20241015123931.867842821@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015123916.821186887@linuxfoundation.org> References: <20241015123916.821186887@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 5.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 @@ -1010,6 +1010,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);