summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-integrity.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2018-07-03 20:13:32 +0200
committerMike Snitzer <snitzer@redhat.com>2018-07-27 15:24:26 -0400
commit747829a8e6c6a65e096ce8dd79506cbcf83951ad (patch)
tree8d87021fa40345f6a0685d230556cf4e2f8c061a /drivers/md/dm-integrity.c
parent1f9fc0b826119f8d76d33c3bf60b7426be6dc19e (diff)
downloadlinux-stable-747829a8e6c6a65e096ce8dd79506cbcf83951ad.tar.gz
linux-stable-747829a8e6c6a65e096ce8dd79506cbcf83951ad.tar.bz2
linux-stable-747829a8e6c6a65e096ce8dd79506cbcf83951ad.zip
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: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-integrity.c')
-rw-r--r--drivers/md/dm-integrity.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 1097d8c25577..2d47519c54d7 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -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);
@@ -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);
}