From bcc1ee56c0404b3650979d4cedfb8a6085703fb4 Mon Sep 17 00:00:00 2001 From: Russell Harmon Date: Sun, 28 May 2023 18:51:36 -0700 Subject: [PATCH] Support no-journal for dm-integrity devices. As documented in integritysetup.8, dm-integrity devices support running without a journal whatsoever. This change allows the CRYPT_ACTIVATE_NO_JOURNAL flag (the same as is used with `integritysetup --integrity-no-journal`) to be passed in during dmsetup by specifying the `no-journal` option in integritytab.5. --- man/integritytab.xml | 11 +++++++++++ src/integritysetup/integrity-util.c | 3 +++ 2 files changed, 14 insertions(+) diff --git a/man/integritytab.xml b/man/integritytab.xml index 44f0a559290..44da039ddec 100644 --- a/man/integritytab.xml +++ b/man/integritytab.xml @@ -72,6 +72,17 @@ + + + + + Disable the journal. Corresponds to the "direct writes" mode documented in + the dm-integrity documentation. + Note that without a journal, if there is a crash, it is possible that the integrity tags and data will not match. If used, the journal-* + options below will have no effect if passed. + + + diff --git a/src/integritysetup/integrity-util.c b/src/integritysetup/integrity-util.c index c2d2f950de5..66f93e7d2eb 100644 --- a/src/integritysetup/integrity-util.c +++ b/src/integritysetup/integrity-util.c @@ -34,6 +34,9 @@ int parse_integrity_options( else if (streq(word, "allow-discards")) { if (ret_activate_flags) *ret_activate_flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS; + } else if (streq(word, "no-journal")) { + if (ret_activate_flags) + *ret_activate_flags |= CRYPT_ACTIVATE_NO_JOURNAL; } else if ((val = startswith(word, "journal-watermark="))) { r = parse_percent(val); if (r < 0) -- 2.47.3