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 <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #10659
This commit is contained in:
parent
b6737193ee
commit
da60484db5
|
@ -9692,6 +9692,13 @@ out:
|
||||||
"no valid log blocks");
|
"no valid log blocks");
|
||||||
bzero(l2dhdr, dev->l2ad_dev_hdr_asize);
|
bzero(l2dhdr, dev->l2ad_dev_hdr_asize);
|
||||||
l2arc_dev_hdr_update(dev);
|
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) {
|
} else if (err != 0) {
|
||||||
spa_history_log_internal(spa, "L2ARC rebuild", NULL,
|
spa_history_log_internal(spa, "L2ARC rebuild", NULL,
|
||||||
"aborted, restored %llu blocks",
|
"aborted, restored %llu blocks",
|
||||||
|
|
Loading…
Reference in New Issue