Am 12.05.26 um 2:21 PM schrieb Kevin Wolf: > Am 29.04.2026 um 17:28 hat Fiona Ebner geschrieben: >> 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? > > This is the case the comment inside wait_for_dependencies() is about: > > /* > * Discard has some non-coroutine callers (creating internal snapshots and > * make empty). They are calling from qemu-img or in a drained section, so > * we know that no writes can be in progress. > */ > > So it should be fine in practice because we know a bigger hammer is > already in use for synchronisation.
Ah sorry, I missed that. Ignore me then. Best Regards, Fiona
