Commit 747829a8 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Mike Snitzer

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

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

NOTE: the journal is deliberately not flushed when using the same device
for metadata and data, so that the journal replay code is tested.
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 1f9fc0b8
...@@ -2052,7 +2052,7 @@ static void integrity_writer(struct work_struct *w) ...@@ -2052,7 +2052,7 @@ static void integrity_writer(struct work_struct *w)
unsigned prev_free_sectors; unsigned prev_free_sectors;
/* the following test is not needed, but it tests the replay code */ /* 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; return;
spin_lock_irq(&ic->endio_wait.lock); spin_lock_irq(&ic->endio_wait.lock);
...@@ -2287,6 +2287,8 @@ static void dm_integrity_postsuspend(struct dm_target *ti) ...@@ -2287,6 +2287,8 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
drain_workqueue(ic->commit_wq); drain_workqueue(ic->commit_wq);
if (ic->mode == 'J') { if (ic->mode == 'J') {
if (ic->meta_dev)
queue_work(ic->writer_wq, &ic->writer_work);
drain_workqueue(ic->writer_wq); drain_workqueue(ic->writer_wq);
dm_integrity_flush_buffers(ic); dm_integrity_flush_buffers(ic);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment