aio-context question
I just saw commit 30dd65f307b647eef8156c4a33bd007823ef85cb, and noticed that a similar pattern in drive_backup_prepare() and blockdev_backup_prepare().
The calls to bdrv_try_set_aio_context() seems useless, because we already do that later in backup_job_create/brdv_attach.
But I am not 100%& sure?
Am 19.03.2020 um 09:13 hat Dietmar Maurer geschrieben:
Quoted 7 lines
I just saw commit
30dd65f307b647eef8156c4a33bd007823ef85cb, and noticed that a similar pattern indrive_backup_prepare()andblockdev_backup_prepare().The calls to
bdrv_try_set_aio_context()seems useless, because we already do that later in backup_job_create/brdv_attach.But I am not 100%& sure?
I'm aware that this is a common pattern (and I thought it was more than just two additional places), but we would have to check for each place individually whether it can be removed.
If it doesn't have any effect because it just does what will be done later anyway, it can be removed, but that doesn't buy us much.
If it results in preventing some case (like the one fixed by 30dd65f3), we need to check whether this case is actually safe. If it is safe, we can remove the lines and get a new feature from it.
In both cases, I think a test case should be written together with the removal of the code. And if we find out that it's unsafe, we should even more write a test case that makes sure that the operation fails.
Kevin
Quoted 2 lines
If it doesn't have any effect because it just does what will be done later anyway, it can be removed, but that doesn't buy us much.
I think that code is simply unnecessary (no effect). But it is quite hard to read and understand, so I think removing that code helps to simplify things.
Quoted 7 lines
If it results in preventing some case (like the one fixed by
30dd65f3), we need to check whether this case is actually safe. If it is safe, we can remove the lines and get a new feature from it.In both cases, I think a test case should be written together with the removal of the code. And if we find out that it's unsafe, we should even more write a test case that makes sure that the operation fails.
Yes, a test case would be great. Especially one that test backups with io-threads.
I am hunting a bug for more than a week now. Seems bdrv_drain hangs sometimes when running a backup job on drives using io-threads ...
But I still haven't found a reliable way to reproduce it. Sometimes takes me several hours to trigger it again...
I will try to write a test case if I can really find that bug...