]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ocfs2: fix clusters leak in ocfs2_defrag_extent()
authorLarry Chen <lchen@suse.com>
Fri, 2 Nov 2018 22:48:27 +0000 (15:48 -0700)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:21:01 +0000 (14:21 -0300)
commitaf80a8635570a3f9d2640279f4e9f9c56b9c8ea7
tree228f11b5c92adcf577b62f0ee96eaf68b6ce53fb
parentaf1462756625c2098481042c5d009abdc384c7f1
ocfs2: fix clusters leak in ocfs2_defrag_extent()

BugLink: https://bugs.launchpad.net/bugs/1854975
[ Upstream commit 6194ae4242dec0c9d604bc05df83aa9260a899e4 ]

ocfs2_defrag_extent() might leak allocated clusters.  When the file
system has insufficient space, the number of claimed clusters might be
less than the caller wants.  If that happens, the original code might
directly commit the transaction without returning clusters.

This patch is based on code in ocfs2_add_clusters_in_btree().

[akpm@linux-foundation.org: include localalloc.h, reduce scope of data_ac]
Link: http://lkml.kernel.org/r/20180904041621.16874-3-lchen@suse.com
Signed-off-by: Larry Chen <lchen@suse.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/ocfs2/move_extents.c