]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix recovery import (-F) with encrypted pool
authorTom Caputi <tcaputi@datto.com>
Mon, 4 Dec 2017 19:10:31 +0000 (14:10 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 2 Feb 2018 19:39:36 +0000 (11:39 -0800)
When performing zil_claim() at pool import time, it is
important that encrypted datasets set os_next_write_raw
before writing to the zil_header_t. This prevents the code
from attempting to re-authenticate the objset_phys_t when
it writes it out, which is unnecessary because the
zil_header_t is not protected by either objset MAC and
impossible since the keys aren't loaded yet. Unfortunately,
one of the code paths did not set this flag, which causes
failed ASSERTs during 'zpool import -F'. This patch corrects
this issue.

Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #6864
Closes #6916

module/zfs/zil.c

index 73744ffcf81c8454d53dcfac58bacb8343bfc71c..234ce956aedaac68c0de0ef69914dcfea1a2acf6 100644 (file)
@@ -819,6 +819,8 @@ zil_claim(dsl_pool_t *dp, dsl_dataset_t *ds, void *txarg)
                if (zilog->zl_parse_lr_count || zilog->zl_parse_blk_count > 1)
                        zh->zh_flags |= ZIL_REPLAY_NEEDED;
                zh->zh_flags |= ZIL_CLAIM_LR_SEQ_VALID;
+               if (os->os_encrypted)
+                       os->os_next_write_raw = B_TRUE;
                dsl_dataset_dirty(dmu_objset_ds(os), tx);
        }