There was a problem that the user burned dm-integrity image on CDROM and
could not activate it becaues it had non-empty journal.

This commit fixes the problem by flushing the journal on suspend.

Note that we deliberately didn't flush the journal on suspend, so that the
journal replay code would be tested. However, the dm-integrity code is 5
years old now, so that journal replay is well-tested, and we can make this
change now.

Signed-off-by: Mikulas Patocka <mpato...@redhat.com>

Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-integrity.c
+++ linux-2.6/drivers/md/dm-integrity.c
@@ -2590,10 +2590,6 @@ static void integrity_writer(struct work
 
        unsigned prev_free_sectors;
 
-       /* the following test is not needed, but it tests the replay code */
-       if (unlikely(dm_post_suspending(ic->ti)) && !ic->meta_dev)
-               return;
-
        spin_lock_irq(&ic->endio_wait.lock);
        write_start = ic->committed_section;
        write_sections = ic->n_committed_sections;
@@ -3101,8 +3097,7 @@ 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);
+               queue_work(ic->writer_wq, &ic->writer_work);
                drain_workqueue(ic->writer_wq);
                dm_integrity_flush_buffers(ic, true);
        }
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to