From 1259f899a312c58d64fb0e9c9eb5dbe1ad963c9e Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 1 Apr 2021 11:39:10 -0700 Subject: [PATCH] srch compaction needs to prepare alloc for commit The srch client compaction work initializes allocators, dirties blocks, and writes them out as its transaction. It forgot to call the pre-commit allocator prepare function. The prepare function drops block references used by the meta allocator during the transaction. This leaked block references which kept blocks from being freed by the shrinker under memory pressure. Eventually memory was full of leaked blocks and the shrinker walked all of them looking blocks to free, resulting in an effective livelock that ground the system to a crawl. Signed-off-by: Zach Brown --- kmod/src/srch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kmod/src/srch.c b/kmod/src/srch.c index 4cca2b0c..372be7fe 100644 --- a/kmod/src/srch.c +++ b/kmod/src/srch.c @@ -2156,7 +2156,8 @@ static void scoutfs_srch_compact_worker(struct work_struct *work) if (ret < 0) goto commit; - ret = scoutfs_block_writer_write(sb, &wri); + ret = scoutfs_alloc_prepare_commit(sb, &alloc, &wri) ?: + scoutfs_block_writer_write(sb, &wri); commit: /* the server won't use our partial compact if _ERROR is set */ sc->meta_avail = alloc.avail;