Il 26/06/2013 05:59, Fam Zheng ha scritto: > > The block job originally had total control over target bs: when the job > completes, the target is deleted. Now it's shared with NBD, so we should make > sure the job completion or canceling wouldn't crash NBD server. This patch > doesn't handle this case: if the block job is ended before NBD exporting, > there'll be problem.
This should not be a problem. When the job completes or cancels it will close s->target. The NBD server has installed a close notifier for s->target, and will close connections with the clients. Similarly, if the source disk is hot-unplugged, the bdrv_close will cancel the job, which in turn closes connections with the clients. So this just works as long as no hot-unplug happens and as long as the job doesn't complete: the client can use the point-in-time snapshot via NBD as long as it cares to. This leads to another observation: a sync:'none' block-backup job probably should never complete, and should instead go on until explicit cancellation. This is because the job does no background writes, and thus completion would only happen after the guest has written the whole disk. Writing the whole disk is rare enough that it will likely cause bugs in the clients. It is easier just to never complete the job. Paolo