btrfs: fix transaction handle leak after verity rollback failure
During a verity rollback, if we fail to update the inode or delete the orphan, we abort the transaction and return without releasing our transaction handle. Fix that by releasing the handle. Fixes:146054090b
("btrfs: initial fsverity support") Fixes:705242538f
("btrfs: verity metadata orphan items") Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Родитель
bbc9a6eb5e
Коммит
acbee9aff8
|
@ -451,7 +451,7 @@ static int del_orphan(struct btrfs_trans_handle *trans, struct btrfs_inode *inod
|
|||
*/
|
||||
static int rollback_verity(struct btrfs_inode *inode)
|
||||
{
|
||||
struct btrfs_trans_handle *trans;
|
||||
struct btrfs_trans_handle *trans = NULL;
|
||||
struct btrfs_root *root = inode->root;
|
||||
int ret;
|
||||
|
||||
|
@ -473,6 +473,7 @@ static int rollback_verity(struct btrfs_inode *inode)
|
|||
trans = btrfs_start_transaction(root, 2);
|
||||
if (IS_ERR(trans)) {
|
||||
ret = PTR_ERR(trans);
|
||||
trans = NULL;
|
||||
btrfs_handle_fs_error(root->fs_info, ret,
|
||||
"failed to start transaction in verity rollback %llu",
|
||||
(u64)inode->vfs_inode.i_ino);
|
||||
|
@ -490,8 +491,9 @@ static int rollback_verity(struct btrfs_inode *inode)
|
|||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
||||
btrfs_end_transaction(trans);
|
||||
out:
|
||||
if (trans)
|
||||
btrfs_end_transaction(trans);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче