Skip to content

Commit

Permalink
dm integrity: flush journal on suspend when using separate metadata d…
Browse files Browse the repository at this point in the history
…evice

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: Mikulas Patocka <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
  • Loading branch information
Mikulas Patocka authored and snitm committed Jul 27, 2018
1 parent 1f9fc0b commit 747829a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/md/dm-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -2052,7 +2052,7 @@ static void integrity_writer(struct work_struct *w)
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);
Expand Down Expand Up @@ -2287,6 +2287,8 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
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);
}
Expand Down

0 comments on commit 747829a

Please sign in to comment.