提交 98bd5c54 编写于 作者: D David Sterba 提交者: Chris Mason

btrfs: sync ioctl, handle errors after transaction start

The version merged to 3.19 did not handle errors from start_trancaction
and could pass an invalid pointer to commit_transaction.

Fixes: 6b5fe46d ("btrfs: do commit in sync_fs if there are pending changes")
Reported-by: NFilipe Manana <fdmanana@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.cz>
Signed-off-by: NChris Mason <clm@fb.com>
上级 6f896054
......@@ -1001,9 +1001,9 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
if (fs_info->pending_changes == 0)
return 0;
trans = btrfs_start_transaction(root, 0);
} else {
return PTR_ERR(trans);
}
if (IS_ERR(trans))
return PTR_ERR(trans);
}
return btrfs_commit_transaction(trans, root);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册