Am 27.04.26 um 7:04 PM schrieb Kevin Wolf: > @@ -2000,6 +2028,15 @@ int qcow2_cluster_discard(BlockDriverState *bs, > uint64_t offset, > int64_t cleared; > int ret; > > + /* > + * If we're touching a cluster for which allocating writes are in flight, > + * wait for them to complete to avoid conflicting metadata updates. > + * > + * We don't need to allocate a QCowL2Meta for the discard operation > because > + * s->lock is held for the duration of the whole operation.
The caller in qcow2_make_empty() does not acquire s->lock AFAICS. Can that be a problem? > + */ > + wait_for_dependencies(bs, offset, bytes); > + > /* Caller must pass aligned values, except at image end */ > assert(QEMU_IS_ALIGNED(offset, s->cluster_size)); > assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) ||
