> 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. > 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...