From nobody Sat Feb 7 20:59:31 2026 Received: from mail-dy1-f173.google.com (mail-dy1-f173.google.com [74.125.82.173]) (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 E9CDF2BDC05 for ; Wed, 7 Jan 2026 21:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767819730; cv=none; b=srsrzR90PL2kgnsIRWTE1CjjVzxzdxWaI5V5Ord/tqjyZyb42Y9DPEokWUJOQg+kWVOYOWs7mU4SUPfQTnoMDVcjlHbCR1FK8s6T7in3IdkPECZED3c1UGUGqtGxM+arMWfewHXLojpeDWiPoMFQc7rHOdUaC8Cnpnm1AM5k9io= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767819730; c=relaxed/simple; bh=MH9ItMzBcZTluvZqALSZ1F57m7cvQEt2yG0/5jKRRIU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GSaG9gEV8OADpDm2TPxqrSsdEtkI/FGLw3kpaiPAgLQf1Xykd9VagqJzQvKMklHUxl53eKQbcB7qFy8DV7O2DVBdiDOhQmuqhome+JylYHFl/bKDTjuOf2tspsbe8YTkZHUIeV7s1C4jmBWBLE/lrDqS6vrdeEKjtrH+Z3hImKY= 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=ci4kyi3z; arc=none smtp.client-ip=74.125.82.173 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="ci4kyi3z" Received: by mail-dy1-f173.google.com with SMTP id 5a478bee46e88-2ae29ddaed9so623804eec.0 for ; Wed, 07 Jan 2026 13:02:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767819728; x=1768424528; 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=rI9ht6zLDnTdHsEUK/2YLyBXC/hQ/zyK3ZFH+/rd3ZU=; b=ci4kyi3zD2j7KiLUjQkIcDU7vuOsX6S4mJZQ4AVy+npgOrbsZh/gpA6dORUo6X6ds9 Tw8napnxETN5al9CCa2jPUtv+17djSqaDZqFicacXROVkiQlgyo6Vp4M1aXCupq0tRUQ vJVtuOlv6CEzy3AIwBCADL6oDk2iqiIGlzCNaat5/llGCRur5W7Wm4narV0IDWbTOz1Y Y9ne0NH9h9fdsqH9bQh0aeKxp5rp8DPdnIQP+9Qqs+VPUcNxVQNN+RN89Fk47Y7QNU6Z laBqZktA3/2NYT/Bi993LIQGBXVsEnfVQVXNXJO+9OhYjWN/fhPDLGQfeb+xo0vTxV/K Z3Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767819728; x=1768424528; 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=rI9ht6zLDnTdHsEUK/2YLyBXC/hQ/zyK3ZFH+/rd3ZU=; b=lBd7xvgF5r8XY4wXB1VtL3BvrwQrov1anuqX66PeiirY91hzPoRg4wgL44bDyFr4Jd wlv3Yfs1emM4lXuUcU4v+gbApCnWk0zi/m7lB0XvYUmT/XVjPJXadMNTL2Zb5E3uQD1V pgddsGCrrKwm15TNvO5SUBlaVWZ054OkcMemj+h1IU3XmntQ2pdbuBl8UwluQ69H/w16 +iYPW04qEG9mVPHnr3DFKBtbsUEl6ho/rlM/KHmnbK++3dPMjOuIDa1CzQFSaVADHDgP 1f4X2MuzCuq34RcFnxNDxmQ9+ywuRm0xCOH3I9lzSmGJC4iINw3Ghoqwlu0arFEWWiRJ X/4g== X-Forwarded-Encrypted: i=1; AJvYcCVXs/78yloSp5+WG6gDLzYgEkhui3HlBV0MzPuMRtjUBeyAGIOcJr41pZLOtukBFibiV/QREcVkp6b/YRk=@vger.kernel.org X-Gm-Message-State: AOJu0YyiKwkreFqygMvoKmQ2BGaqgyzhBtR9QZ5RMyP1wy4v5dNpzbOu 6w3G9ymH1zqVhEsL82C8/oe0ATGV4kW9hrI+5kFYVDXQ1PQVziyjyZTjLXhp/A== X-Gm-Gg: AY/fxX6N3Sa0jZq7Ygf/kX4rua+gKiFlNGCN8pD/YBcQHq2G7zl0qzRtAtERxmMp5ii uYlJwuRu1Dwk3wW0CSup3aWpc0Y3CXS3N8Ey3VpCgNSsUg5y857pu7ym8SqFzouyIlLucHKGQ0E +HclPKiMcg1i+EEbw54OQB6Jd1P7KDypEY8s9n69skpHmlAjFKyXUiK/UQlpRV4DUg2koIbDuDh ivG6vZRsFt539tH7MPq327vE2Iymg+ilPEbXSdSMjp+w+Dju+CHHq841cn6PFkxs4B2FSC8Lcmi LcNEXQcRIF0WJWDNNzCyqPH3K2rt/1Do1glHiCZXsGX0iq60yF7WZTJoLgH1IqM6HHT6PqNnaxK LpcdM4lU56+VR/4lRdqm+dKLsPcFeNbR/LgB0idx5XBkoaXuzOXCS+N0fl2MVSeqRBfTSVyzusT rVvelRJLaOstsEE851RtXEHuLEZUK0J1pnP+RYxTq6P4qNFNgijrVlzfxX+5oE X-Google-Smtp-Source: AGHT+IGz/j2Ai3L0sVPhta32pFiq7xX5jIWUYZAFCkfFw3N2nVApKTu2oj9sPXVOchzP/JfTY8hCxQ== X-Received: by 2002:a05:7301:700e:b0:2ae:4c10:138c with SMTP id 5a478bee46e88-2b16fe5a43bmr3571639eec.11.1767819727866; Wed, 07 Jan 2026 13:02:07 -0800 (PST) Received: from celestia.turtle.lan (static-23-234-115-121.cust.tzulo.com. [23.234.115.121]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b170673b2esm7730320eec.6.2026.01.07.13.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jan 2026 13:02:07 -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 v2 1/6] ceph: Do not propagate page array emplacement errors as batch errors Date: Wed, 7 Jan 2026 13:01:34 -0800 Message-ID: <20260107210139.40554-2-CFSworks@gmail.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20260107210139.40554-1-CFSworks@gmail.com> References: <20260107210139.40554-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. (Subsequent patches in this series make the loop more robust.) Note that this failure mode is currently masked due to another bug (addressed later 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. The next patch in this series addresses this. 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.51.2