On Tue, Jun 01, 2021 at 05:32:33PM +0200, Lukas Straub wrote: > > I have one pure question not directly related to Leo's patch (probably for > > Lukas?): we check OBJECT(ioc)->ref == 1 when unregister each function. In > > what > > case will the ref be not one? > > > > If a return path is opened with qemu_file_get_return_path(), it will > take additional references: > > qemu_file_get_return_path() (qemu-file.c) > f->ops->get_return_path() -> channel_get_input_return_path() > (qemu-file-channel.c) > qemu_fopen_channel_input() (qemu-file-channel.c) > object_ref(OBJECT(ioc))
Makes sense. Wondering whether it's better to unregister in migrate_fd_cleanup() rather than channel_close(), as we used to register in migration code rather than in qemu file wrapper layer. I feel like we can drop the ref==1 check if we move, as the return path should have been closed when reaching migrate_fd_cleanup() (similar doubt to multifd_load_cleanup() calls to yank_unregister_function()). No strong opinion, though.. Thanks, -- Peter Xu