Skip to contentSkip to conversation

dm-integrity: flush journal on suspend when using separate device

PATCH In review Mikulas Patocka 1 participant 1 message Jun 6, 2018 Device mapper

lore
Share & tools
lore

Mikulas Patocka

author maintainer
#0 lore raw

PATCH 8/9 dm-integrity: flush journal on suspend when using separate device

Flush the journal on suspend when using separate data and metadata device, so that the metadata device can be discarded and the table can be reloaded with a linear target pointing to the data device.

Note: we deliberately don't flush the journal when using the same device for metadata and data, so that the journal replay code is tested.

---
 drivers/md/dm-integrity.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/dm-integrity.c +3 -1
Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
@@ -2051,7 +2051,7 @@ static void integrity_writer(struct work
 	unsigned prev_free_sectors;
 
 	/* the following test is not needed, but it tests the replay code */
-	if (READ_ONCE(ic->suspending))
+	if (READ_ONCE(ic->suspending) && !ic->meta_dev)
 		return;
 
 	spin_lock_irq(&ic->endio_wait.lock);
@@ -2286,6 +2286,8 @@ static void dm_integrity_postsuspend(str
 	drain_workqueue(ic->commit_wq);
 
 	if (ic->mode == 'J') {
+		if (ic->meta_dev)
+			queue_work(ic->writer_wq, &ic->writer_work);
 		drain_workqueue(ic->writer_wq);
 		dm_integrity_flush_buffers(ic);
 	}