From: Josef Bacik Date: Fri, 9 Dec 2011 18:26:22 +0000 (-0500) Subject: Btrfs: fix leaked space in truncate X-Git-Tag: v5.15~23558^2~1^2~2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=7041ee97281c30a78658904140c7bd9373a36142;p=mirror_ubuntu-kernels.git Btrfs: fix leaked space in truncate We were occasionaly leaking space when running xfstest 269. This is because if we failed to start the transaction in the truncate loop we'd just goto out, but we need to break so that the inode is removed from the orphan list and the space is properly freed. Thanks, Signed-off-by: Josef Bacik --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8938174e6bc1..6349c63a4b37 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6566,8 +6566,9 @@ static int btrfs_truncate(struct inode *inode) /* Just need the 1 for updating the inode */ trans = btrfs_start_transaction(root, 1); if (IS_ERR(trans)) { - err = PTR_ERR(trans); - goto out; + ret = err = PTR_ERR(trans); + trans = NULL; + break; } }