summaryrefslogtreecommitdiffstats
path: root/module/zfs/arc.c
diff options
context:
space:
mode:
authorGeorge Amanakis <[email protected]>2020-08-01 14:17:18 -0400
committerGitHub <[email protected]>2020-08-01 11:17:18 -0700
commitda60484db5960f2b94cf3302dd08fe7fb673eaf3 (patch)
treee48dc4a7e6db08f0285d2910a23698a11771320e /module/zfs/arc.c
parentb6737193ee601cc213d3630e4603f9883b6002ad (diff)
Fix logging in l2arc_rebuild()
In case the L2ARC rebuild was canceled, do not log to spa history log as the pool may be in the process of being removed and a panic may occur: BUG: kernel NULL pointer dereference, address: 0000000000000018 RIP: 0010:spa_history_log_internal+0xb1/0x120 [zfs] Call Trace: l2arc_rebuild+0x464/0x7c0 [zfs] l2arc_dev_rebuild_start+0x2d/0x130 [zfs] ? l2arc_rebuild+0x7c0/0x7c0 [zfs] thread_generic_wrapper+0x78/0xb0 [spl] kthread+0xfb/0x130 ? IS_ERR+0x10/0x10 [spl] ? kthread_park+0x90/0x90 ret_from_fork+0x35/0x40 Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: George Amanakis <[email protected]> Closes #10659
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r--module/zfs/arc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 9399f9721..31f046784 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -9692,6 +9692,13 @@ out:
"no valid log blocks");
bzero(l2dhdr, dev->l2ad_dev_hdr_asize);
l2arc_dev_hdr_update(dev);
+ } else if (err == ECANCELED) {
+ /*
+ * In case the rebuild was canceled do not log to spa history
+ * log as the pool may be in the process of being removed.
+ */
+ zfs_dbgmsg("L2ARC rebuild aborted, restored %llu blocks",
+ zfs_refcount_count(&dev->l2ad_lb_count));
} else if (err != 0) {
spa_history_log_internal(spa, "L2ARC rebuild", NULL,
"aborted, restored %llu blocks",