From nobody Sat Feb 7 11:31:27 2026 Received: from mail-dl1-f49.google.com (mail-dl1-f49.google.com [74.125.82.49]) (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 61C0A285C96 for ; Mon, 26 Jan 2026 02:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769394668; cv=none; b=juPujXOsHtXEqmiKyo4bM3ynYjLrWvKN7tWR2hL++Z/ZB2HQeyHgTyj+bFmxt2oMkyhWccQQ8Xha+FAuRdFWt0+Jzc/mUtKnafJuya2UlpW1P4Kbu62q559+cxQLGo4HTinzA2MD6KqeaqwsLDJrhY4MhvevTmQCr/C/lQ7zoPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769394668; c=relaxed/simple; bh=2r3QgcjH7GZMruE67ZsjvUp6p/exK5sB1NKVz9e2BfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SfmDfucZPgnJyHibtS5+MbwHi96aKCNSC17e+FWEeq9nthMysxi0VoMOxe+ZpsyBjug8HKglu4DG5+SXo2DHMATkqmWi788YXL5JSN/yLkHa+Q1+mlb8XTKLHUXjVXzcGDKpgtaSLnkEE7elyHcNQt4rdi+R1BhC/UVHDj5KbE0= 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=PAHZ408s; arc=none smtp.client-ip=74.125.82.49 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="PAHZ408s" Received: by mail-dl1-f49.google.com with SMTP id a92af1059eb24-1232d9f25e9so769389c88.0 for ; Sun, 25 Jan 2026 18:31:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769394666; x=1769999466; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0m877IielwhZYxUtpH2DsnWNPP6T5OXQthZEWEyOygI=; b=PAHZ408sgWRqlfTkQMqroDt+XD+0tL/RZvpJPYvVjIgKYJJ29l/xASZO6X8WVHQ3Aq 0lEdfQQdp/ti6HvGzKgLbEFKXGSA1+s35Xw//2Lv9zu5CW1fizPPwzmVtG08GMufBOZA Q8T0mp5xTCpN8THVp7Ej0y+W+WRzq2CXVcUtrqbxj7v5DyAMWcOgjx63fNh7oVfsNlGM Y4+yWkk/jMoxbb0CDLGEAxuEPSlVRp+sJ4gqE3553l4wdESAckyHDuIlab58NVXWRoqg cmYKvsk4sfbklu/760JBvlpU+PWJHgV3cm2d1aVfHyiCBoiMfgfd7Lh3oQMUOfQz3OIE cQhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769394666; x=1769999466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0m877IielwhZYxUtpH2DsnWNPP6T5OXQthZEWEyOygI=; b=f4278wp/73Uor0rWCEff9LcVwX26rEj4b7cc7kqR638htfvV+ebe28j9bi7+h9SeGA b0vOxHWru6WPn7NR2EYEyOj/A5gZynAb8OgNlk/PH2lrN07vSJoI8xWbBJhPC+cDn1rq ZSr5z4YtzJNwyOxQyOk3YVhASBTpytmD/hllqsqO3SlvT9ys92kht9AUR9GyYMJKCGLy coCTnW2IwEnjWMIYupref2uL/wBq0e41/81ls9EMfljLY6QCX9xl2Lc3koCflhFiWFGV nZy6PpweXKGqsZdlfE8izs6dIkO+D4IP5w8vBxtmoJj/fxkzCvkpC172Yb9Ab5TgFqbo fhKw== X-Forwarded-Encrypted: i=1; AJvYcCUh76eMsxBtIB+elU16b02LXF4EJ5xJXXsfnNsZsINzA9X7NTc5rZD0gOBEoLHPY+6vmxoaGZ1nnCa1tJo=@vger.kernel.org X-Gm-Message-State: AOJu0YztiQKqL2+tk6f+2zhNetuRrmbjhAptNcAf6d8dZI/CvR4VqWLN fn0FF0Q4uYAOPL3HyBi1w+QXiqpzeNbRVMDYehFomJx7YmO6LpokJRPx X-Gm-Gg: AZuq6aLtMN8wxR8aNqsQsJAmGRfYzz2TxguLOlE+jDG/9O2/LcBQUKO5ukCCfOadUPC uIalll3cv8HCOj/pSKlNFgG2ix51LgkFtrotL7Kqk9j0yYosCejxN+fzxGacSwtJ8smBjpHBHTr l06zpwmUrZt6ikCRc/d+QOAGM8FQeXZ+XpaPB4/ZcRL4Yl4XVROcV6pwQ60d/zj0p7ydUn/5P2y p/g7KGogdO48xGhmw5g3GGMvgmvTMDZ1uc76FeHBsGCTfNUGWWoqofW84Reqa5KfkWsCHbK5gM3 MFvQ/le06q3QiivXORhENcQ8s2vbKCx6GVyx6PbsdwtlvFZ5oPtOsuUVfW38ACpDgyAcKgPAsYL ROi/cfdDV7M3EYxxe82rr7D3sAiNisTiOKxavMYtWaSoj2ts1KAg74NlZzzuHyU1wLL8QNvq5ux i4JsRMKPt5rmGRANGdgPemL9ahhr7LcwZJ8XniI6ViRriKFgsZPkk3 X-Received: by 2002:a05:7022:6183:b0:123:3356:7abb with SMTP id a92af1059eb24-1248ec87252mr1826327c88.46.1769394666463; Sun, 25 Jan 2026 18:31:06 -0800 (PST) Received: from luna.turtle.lan (static-23-234-93-211.cust.tzulo.com. [23.234.93.211]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1247d91c52bsm17212277c88.6.2026.01.25.18.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 18:31:06 -0800 (PST) From: Sam Edwards X-Google-Original-From: Sam Edwards To: Xiubo Li , Ilya Dryomov Cc: Viacheslav Dubeyko , Christian Brauner , Milind Changire , Jeff Layton , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Sam Edwards , stable@vger.kernel.org Subject: [PATCH v3 1/4] ceph: do not propagate page array emplacement errors as batch errors Date: Sun, 25 Jan 2026 18:30:52 -0800 Message-ID: <20260126023055.405401-2-CFSworks@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260126023055.405401-1-CFSworks@gmail.com> References: <20260126023055.405401-1-CFSworks@gmail.com> 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" When fscrypt is enabled, move_dirty_folio_in_page_array() may fail because it needs to allocate bounce buffers to store the encrypted versions of each folio. Each folio beyond the first allocates its bounce buffer with GFP_NOWAIT. Failures are common (and expected) under this allocation mode; they should flush (not abort) the batch. However, ceph_process_folio_batch() uses the same `rc` variable for its own return code and for capturing the return codes of its routine calls; failing to reset `rc` back to 0 results in the error being propagated out to the main writeback loop, which cannot actually tolerate any errors here: once `ceph_wbc.pages` is allocated, it must be passed to ceph_submit_write() to be freed. If it survives until the next iteration (e.g. due to the goto being followed), ceph_allocate_page_array()'s BUG_ON() will oops the worker. Note that this failure mode is currently masked due to another bug (addressed next in this series) that prevents multiple encrypted folios from being selected for the same write. For now, just reset `rc` when redirtying the folio to prevent errors in move_dirty_folio_in_page_array() from propagating. Note that move_dirty_folio_in_page_array() is careful never to return errors on the first folio, so there is no need to check for that. After this change, ceph_process_folio_batch() no longer returns errors; its only remaining failure indicator is `locked_pages =3D=3D 0`, which the caller already handles correctly. Fixes: ce80b76dd327 ("ceph: introduce ceph_process_folio_batch() method") Cc: stable@vger.kernel.org Signed-off-by: Sam Edwards --- fs/ceph/addr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 63b75d214210..3462df35d245 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1369,6 +1369,7 @@ int ceph_process_folio_batch(struct address_space *ma= pping, rc =3D move_dirty_folio_in_page_array(mapping, wbc, ceph_wbc, folio); if (rc) { + rc =3D 0; folio_redirty_for_writepage(wbc, folio); folio_unlock(folio); break; --=20 2.52.0