qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/6] qcow2: fix parallel rewrite and discard (lockless)
@ 2021-03-26 20:00 Vladimir Sementsov-Ogievskiy
  2021-03-26 20:00 ` [PATCH v5 1/6] iotests: add qcow2-discard-during-rewrite Vladimir Sementsov-Ogievskiy
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2021-03-26 20:00 UTC (permalink / raw)
  To: qemu-block; +Cc: qemu-devel, mreitz, kwolf, vsementsov, den

Hi all!

It's an alternative lock-less solution to
  [PATCH v4 0/3] qcow2: fix parallel rewrite and discard (rw-lock)

It's an updated version of what was don in
  [PATCH v3 0/6] qcow2: compressed write cache

I've split the logic into several patches, add a lot more comments and
documentation, I hope it's all now a lot more clean. 

Main change from v3 is careful handling "freeing" the cluster. The
concept of "free cluster" is established. And good thing: now updating
inflight-counters it lock-less: we don't need the lock for discard
operation, instead we consider this discard as the last one inflight
write!

The solution is still more complicated then co-rw-lock based one. But it
is cool and I hope someone like it.

RFC: should we protect reads as well of intersecting with discarding
host clusters? I think yes. Reads are not as critical, as they can't
corrupt the metadata or data (due to use-after-free like writes), but
with reads it's possible that guest reads some metadata cluster. It's a
kind of security violation I think.

Vladimir Sementsov-Ogievskiy (6):
  iotests: add qcow2-discard-during-rewrite
  qcow2: fix cache discarding in update_refcount()
  qcow2: introduce is_cluster_free() helper
  qcow2: introduce inflight-write-counters
  qcow2: consider in-flight-writes when freeing clusters
  qcow2: do not discard host clusters during in-flight writes

 block/qcow2.h                                 |  16 ++
 block/qcow2-refcount.c                        | 184 +++++++++++++++++-
 block/qcow2.c                                 |  26 ++-
 .../tests/qcow2-discard-during-rewrite        |  72 +++++++
 .../tests/qcow2-discard-during-rewrite.out    |  21 ++
 5 files changed, 308 insertions(+), 11 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/qcow2-discard-during-rewrite
 create mode 100644 tests/qemu-iotests/tests/qcow2-discard-during-rewrite.out

-- 
2.29.2



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-04-07 16:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 20:00 [PATCH v5 0/6] qcow2: fix parallel rewrite and discard (lockless) Vladimir Sementsov-Ogievskiy
2021-03-26 20:00 ` [PATCH v5 1/6] iotests: add qcow2-discard-during-rewrite Vladimir Sementsov-Ogievskiy
2021-03-26 20:00 ` [PATCH v5 2/6] qcow2: fix cache discarding in update_refcount() Vladimir Sementsov-Ogievskiy
2021-04-07 16:34   ` Alberto Garcia
2021-03-26 20:00 ` [PATCH v5 3/6] qcow2: introduce is_cluster_free() helper Vladimir Sementsov-Ogievskiy
2021-03-26 20:00 ` [PATCH v5 4/6] qcow2: introduce inflight-write-counters Vladimir Sementsov-Ogievskiy
2021-03-30 12:05   ` Vladimir Sementsov-Ogievskiy
2021-03-26 20:00 ` [PATCH v5 5/6] qcow2: consider in-flight-writes when freeing clusters Vladimir Sementsov-Ogievskiy
2021-03-26 20:00 ` [PATCH v5 6/6] qcow2: do not discard host clusters during in-flight writes Vladimir Sementsov-Ogievskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).