Просмотр исходного кода

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 <josef@redhat.com>
Josef Bacik 14 лет назад
Родитель
Сommit
7041ee9728
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      fs/btrfs/inode.c

+ 3 - 2
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;
 			}
 		}