From c8242a96ba8495013cc2f2e12ea6202e61796462 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Tue, 13 Aug 2019 08:11:57 -0600 Subject: spa_load_verify() may consume too much memory When a pool is imported it will scan the pool to verify the integrity of the data and metadata. The amount it scans will depend on the import flags provided. On systems with small amounts of memory or when importing a pool from the crash kernel, it's possible for spa_load_verify to issue too many I/Os that it consumes all the memory of the system resulting in an OOM message or a hang. To prevent this, we limit the amount of memory that the initial pool scan can consume. This change will, by default, use 1/16th of the ARC for scan I/Os to prevent running the system out of memory during import. Reviewed-by: Matt Ahrens Reviewed-by: Brian Behlendorf Reviewed-by: Serapheim Dimitropoulos Signed-off-by: George Wilson george.wilson@delphix.com External-issue: DLPX-65237 External-issue: DLPX-65238 Closes #9146 --- include/sys/spa_impl.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/sys/spa_impl.h') diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h index ebe14dae4..503600c8c 100644 --- a/include/sys/spa_impl.h +++ b/include/sys/spa_impl.h @@ -272,7 +272,9 @@ struct spa { boolean_t spa_extreme_rewind; /* rewind past deferred frees */ kmutex_t spa_scrub_lock; /* resilver/scrub lock */ uint64_t spa_scrub_inflight; /* in-flight scrub bytes */ - uint64_t spa_load_verify_ios; /* in-flight verification IOs */ + + /* in-flight verification bytes */ + uint64_t spa_load_verify_bytes; kcondvar_t spa_scrub_io_cv; /* scrub I/O completion */ uint8_t spa_scrub_active; /* active or suspended? */ uint8_t spa_scrub_type; /* type of scrub we're doing */ -- cgit v1.2.3