From nobody Mon Sep 28 11:39:59 2026 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EB3F37C92F for ; Sat, 22 Aug 2026 14:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787407271; cv=none; b=Umu6oLswfJUeGRejxF7EuLG1d8lnIthQ4B3vYpnk3xrQX7y703J7ELkL7zXtWIYQOqKF8K2gMof2NHTT0gnhqpIUgITbMeOxSCuvOdAw5Au5lhZFrb0GEn/qv/pSfMcvHvFG1CXs/qkt/os5F+MbzDQQyqlqCktSU9mN+rwe6E8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787407271; c=relaxed/simple; bh=ItAPIJfq+jxhLD6TN4Ax4mr21FpxALWDPXzcFTXc3IE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cY8FiG6lEN7nkC7XzP79djtL4BaS81r9EvKwxtPmbnTEnKNeFHCSgpnNaCPpPtL3XpsFmDC43oKtn0SnGhFMwQHUZ9rMohD77fhNryzn72tZre9BbXD0aRrCTDWb61ne14Q0y1i2gXn4iprs/Rsilfjs3vMgc7gt9Yy8qCqwgro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TnJMfj2O; arc=none smtp.client-ip=209.85.210.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TnJMfj2O" Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-7eb29ed2bbdso1383883a34.2 for ; Sat, 22 Aug 2026 07:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787407268; x=1788012068; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=RAu2d0iA448dCKNC/0dAOo9eNJ/v3Puws2Lutq5hDZo=; b=TnJMfj2OInsCpAILIlo2YhMTOXwmMP3OPhvXepJDO6e/kp2VqQeYoT0bjxlle416s4 TSf2mWyAQ2ajk9YfqSLDeurwqMieKl2cN8I7XBxjEmSg6XQs2H7ykWc0e5MEFwRMelHx 9VM5jBmwZlgXMAPbGPDSWmvEXbbc2W3NCtAlQnssoiOK81CefZcHpqNq+GTZ+hChHcN1 WBcKD86OTFGDhiAfMazrRVSLVrVsoW2lukhQVR93lK3Bz1It2LCpj7uxy1yZKmB08Ufz 1J/g47PJXkvKRXemGNixdRXQ1Phklju5bOlJi/p6hiFqdoclwRX0YHNsecdhWn3rb6G9 7Q0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787407268; x=1788012068; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=RAu2d0iA448dCKNC/0dAOo9eNJ/v3Puws2Lutq5hDZo=; b=LO6Ofl8rDowGEmAyUkc2wuo+b9sqjpi1dGRRmqFNDuKhWpHXdoZhpyO6rpQ+o2pgYr hiZr7srFlDU/Oyisd34AdxaOVqFuT8+Xu2VIZG6VKFOtgTq5x5tjETvnPT99sz7m5LlS AlqZRseDh+L+h3nBui3c41y9AOVu3xrHXyjUcDXsJPPABifUQdV9A7CLHiue9mrvE6ZS upxQgP6Obs421M2Oge7gNI6jGJJ0nJeLODH9oD5cQwXMcAI3Jfecu+otTBtIU7atCEtL dxDJSnA9gK2kTMfX9Dze6qhXpc3U6C1Sth+oPCqn9bBnZLDX0eTzzDidF2DAOXrlVNJ9 alTg== X-Forwarded-Encrypted: i=1; AHgh+RoTMVEM7Lijgg60cuE/QmjA9pQa4TNgev2y67ts2hSv87iJYc/4BoorW9q0mM7iUxLtO2ivovJazwM+rKA=@vger.kernel.org X-Gm-Message-State: AFuF++n7jEVud1iqNKKqr0Icar6v6KpuZlKJqTn49A60q1mYJO2lGZKs AQPC8oscr/kXYwC6yzoKRSqYCEy+h98pa1SY+eDQ8Wux7xLCJvnlQrty X-Gm-Gg: AR+sD10Y6pc9lNmPFVouYvi97Zfc/7uHTI5RD/WIkZ31CZBiOqd2rPdv9CFAaQWxLLT DBchKmtXdMyBO6FwyUxzdwm8pQXjeOzh7O//j0pYqkv8ZRPZrwRUgf5RqCDQeLTBldQSy1AKTdz 8fwoxwTCL0UZwhscaD2tswX5u9/0wSVMkcBYn/rGI0QxK2143X+/Vsk0+URhv39urMKuxPSLmnu l5rqNoLw9xQEb7dSWu+RSConBg8C4BQkeiL/f1qvK2paUcB4DUuqiA9cWm8l/IMfWl8Y1sxeKNo a1A1SRhi6WgT4nklxoMBUXomguMPmps6dJFQfuEE7L2V9LqHhHDcaYxKnsOmqq+8XBklsjLcVw5 Tr2UGeLow/WiULcI3k5F4g41zcClxL4HOBgZL6aKUJimHP8jEnJcrvCB9oBsKq7UYo71Oa8H97t 5VGiia+VBBsnRT3DBDICAMCzzyJzo/XFVF+j4vLf7NNNBqxMXDfIekReSfQ9XPu3Uyc0QMtHqAN Kn6ssGItijo/rsY X-Received: by 2002:a05:6820:1686:b0:6b1:6462:7e4a with SMTP id 006d021491bc7-6b164629665mr9378701eaf.13.1787407267786; Sat, 22 Aug 2026 07:01:07 -0700 (PDT) Received: from White.tail445f11.ts.net ([45.127.44.104]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1418619d6ecsm7614856c88.14.2026.08.22.07.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Aug 2026 07:01:07 -0700 (PDT) From: Nikhil Gurudasani To: xiang@kernel.org, chao@kernel.org Cc: zbestahu@gmail.com, jefflexu@linux.alibaba.com, dhavale@google.com, hongbohbli@tencent.com, guochunhai@vivo.com, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] erofs: skip sufficiently large global buffers when resizing Date: Sat, 22 Aug 2026 19:30:17 +0530 Message-ID: <20260822140017.8119-1-nikhilgurudasani314@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" z_erofs_gbuf_nrpages is advanced only after every global buffer has been grown. If a resize fails after some buffers were enlarged, a retry revisits those enlarged buffers. Retrying the same size then returns -ENOMEM because alloc_pages_bulk() has no pages to add and the unchanged return value is treated as a failure. Retrying an intermediate size allocates a temporary pointer array smaller than gbuf->nrpages and copies more existing pointers than the array can hold. Skip buffers that already satisfy the request. Once all remaining buffers have caught up, advancing z_erofs_gbuf_nrpages again describes the guaranteed minimum size across the pool. Fixes: d6db47e571dc ("erofs: do not use pagepool in z_erofs_gbuf_growsize()= ") Cc: stable@vger.kernel.org # 6.10+ Signed-off-by: Nikhil Gurudasani Reviewed-by: Chao Yu Reviewed-by: Gao Xiang --- fs/erofs/zutil.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c index a0ce9226b..6b9bfa2ef 100644 --- a/fs/erofs/zutil.c +++ b/fs/erofs/zutil.c @@ -79,6 +79,8 @@ int z_erofs_gbuf_growsize(unsigned int nrpages) =20 for (i =3D 0; i < z_erofs_gbuf_count; ++i) { gbuf =3D &z_erofs_gbufpool[i]; + if (gbuf->nrpages >=3D nrpages) + continue; tmp_pages =3D kzalloc_objs(*tmp_pages, nrpages); if (!tmp_pages) goto out; base-commit: 075b74841bd0065a3bda3440873c747938e69b68 --=20 2.43.0