From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.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 976DB3B5841 for ; Mon, 10 Aug 2026 23:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403187; cv=none; b=J7BXHrjRYeC+5UyR33u/rK9G3R2N1/CpV5v8vmb9kICWqpUHzd0hwsN9Z4l8EO7sBu/ZpWmwJgC7KqDvvegooNA7EJXS/PyrZtqqQgvOQMOkf5R7bKhSLJDcEYfNCJPI9WYlSxcTImc6MoZyPkMpy4ojfHtAiNrvWCPTINcmPIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403187; c=relaxed/simple; bh=dvPmh2MX3lGbIaGJA+vnikpJaoUwi8NxpixIT/Mz2A0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c6qaahLNLvJtcGVRBzo+wpJFlVOPGouvuutrlu9pdHxXR/sqwhp8X9SznPgK9NfiEkldFrLie35cbHK8RdJn4PRaF3N42X4G4DzkxM4p9qfIlBzeKrXOmb9cy8CRGoB0ig40Ag+juUrmAfPg07fvX48jFbgYyTgPaHgEd/JKqlE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peridio.com; spf=pass smtp.mailfrom=peridio.com; dkim=pass (2048-bit key) header.d=peridio.com header.i=@peridio.com header.b=OLrrpWNr; arc=none smtp.client-ip=209.85.222.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peridio.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peridio.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=peridio.com header.i=@peridio.com header.b="OLrrpWNr" Received: by mail-ua1-f49.google.com with SMTP id a1e0cc1a2514c-977b2fcfdedso62039241.1 for ; Mon, 10 Aug 2026 16:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786403182; x=1787007982; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to:content-type; bh=XY2LsFCEmCQ1uxuh8820Be3psuNjCA8kqH0DVMr4tgE=; b=OLrrpWNrC+r9lTFPzuFN16KekeETeiBjuvzl6xpfZN2YOv+pJ74mwufH3IJWAE9QzQ rFTTFxr4JhWQTKt2tH6gkBoTWs2V86D7MtQK75rAhp4mM9sXv8dApHmthYr8fLCF7uG8 4Mt2mXMw7GhavtL/ozOfURaDXTQofzKgjHrCLXZ1uJojbynDvRidjJtONU1aWQAEDvYT m/+3vyczcz8qX5Qxw1rrwnW2WgGz5sMt9DdBKcAt3dNKRF5Qgw+3YfL4lxc2ojp8avYn zRo/4ts3KumGVoNcPUZQ+IUPAEprWW9AmhBRItgbhFJuLDrHkAnVnRajUNXX+oiPRFq/ fRPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786403182; x=1787007982; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=XY2LsFCEmCQ1uxuh8820Be3psuNjCA8kqH0DVMr4tgE=; b=bWODclKv30KI+GJVvW3hVzkF1zzgldE2hWUrtynkfxAIOWlQZAbEDllM5207lyxOpX PrbYvXjt39/WtE4TKkAb20Z6vEUbbirzWn7SB2HaarMHzm3O3JzcLioOj1sVTrlnUdCx sZhW6D6inPzS8yiMPhYHV+YEsYHRs8jWKkB7QjbSkCgfmzkHfoscjdmeTUKOj7wfJKr+ YQv4x7MEHRf0fRhJcv0/04CsoUtVty/wjh0rScJ2ln8OZg97+dERZ3aumshS6xU3Xifq RfstLmNmULncL3MQ+B/CRqmu5l8QNN9qlVACH5bL6jwOyNGcRMTecodne1LEj1Hjbsqg 7jew== X-Forwarded-Encrypted: i=1; AHgh+RpCXqBnzqrl3KwVVJOyc69PbZFJHNOgH/Q1/U5XyXoHMr/XKACWV2PGoJBOEALrO42uRmCc8kF4udtAp4U=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9KdqblcUE2o1dTdtq6Z4l5nFnjXG5pwPldqRaSD12i2eEFC8K PXEthq63OiLteFSCovD9xXNl/D5WZmVgjEd+yKaQDCSaueLWuWH25t0wbgQ1h6fqnca/BNMyc5i B4yHMITE= X-Gm-Gg: AR+sD11QeJU0AvT55e3/Xmr3Id5EQgk1HIDZjdWzLGDrZ7cGE2e5cKqDqDzs0tH9UyO rUXIAbxmNiazGUBZYhmu7g8UIySwWxISiojuvngI742fZPOwRtlpvsQZMyIgjOi5P3hf+qW+P4v a7NNP2WIM7AmTkXoA6bPpzpTl7wPaLztkvs91vCanDdSjaBoivb9EL3wRLZ2rG9Bw+1VZ+Rnj7C vYyhE2J2bw05nxmtc4vSNuk6muYh6WlK6RJrLoVQDdfZU1+sACr0QRmwMOb0FqGq8oCNY+MLgur iGMF40B8t2JQEcC1fzBfB1b4EqSO19eqnlWD+6T9woua1XIzU46MyGsOKw8cVmHmpV9x7fqE5+U 8KHWxTxtp0HRUkhTEgVoQXRl2P2HNHctNq9HFkn86eKvI6T6nr3PosFxpyMG1CZOxnll7rbF3iw PmnLDcOYBfZC9I8G4MlaZA3LtlVzXg7gAf5Rk1G2n7MT2lshtgqh3LRpIiqjNTduHM X-Received: by 2002:a05:6102:2c16:b0:74d:ce65:3e8b with SMTP id ada2fe7eead31-760e9045be4mr6961995137.2.1786403182482; Mon, 10 Aug 2026 16:06:22 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-763feadcdf4sm5513334137.4.2026.08.10.16.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 16:06:21 -0700 (PDT) Sender: Javier Tia From: Javier Tia X-Google-Original-From: Javier Tia To: Carlos Maiolino Cc: "Darrick J . Wong" , Dave Chinner , Allison Henderson , Andrey Albershteyn , linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/6] xfs: report the error that made deferred work shut down the fs Date: Mon, 10 Aug 2026 17:06:15 -0600 Message-ID: <20260810230611.2859909-11-floss@jetm.me> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260810230611.2859909-8-floss@jetm.me> References: <20260810230611.2859909-8-floss@jetm.me> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2392; i=floss@jetm.me; h=from:subject; bh=dvPmh2MX3lGbIaGJA+vnikpJaoUwi8NxpixIT/Mz2A0=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqelljS1kfyPgZ2EcwoP6u3bIWL9e5ICDwP/7uA KbgYNfEH0qJAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCanpZYwAKCRC17sMLqGd3 H6kVDACM50ty0CdE4rXcPkIWvOe0rLriJDAU8v3i7ycm9G2Al2Yuv8NTzI1FlsCQkW6yOV3iuG8 elwybvxarjhiBrhesER3oglmO6TZ4MKLa+EtdLDA27aSVx3PTaz5L+Q59uMMo8NLU2MZnM55Hel WADaeQqfPDoQTF0BT5GKSGxWtp4/QzEApyDv6GHRvQLPfo5ULBDXNoPCjjxXRExDa6drEd4mw0Z a/Aa4Z4kcq2gSFJC/kGOy+LwzXg1ot7kh8g2POBwZgOH6nkwSb3Zt+Qht5TDaPobStbbCKeSu+9 QnJ9LZgw8V0SJcgHFqaZdhH3G8jBzn4XSfGaa95hDnVIoQHSCo/jAD8mBgVn6z8oSA3ZpO4xB0r EMuRQJ2RBjd7MdPSbFfrwyMYpue3dL2T/L/x47H/tF1QXEWvvCv5h50XeTXehnCDRltRSI0OhkI BW8+uLBX5gFRmVQaTSIHlDcZ7bQukY6Zytg7/4lG8LnQrMcwegssNA7tTcALO4XguarnM= X-Developer-Key: i=floss@jetm.me; a=openpgp; fpr=9B13B20BCF0EDE23454A93C9B5EEC30BA867771F Content-Transfer-Encoding: 8bit When a deferred operation fails and shuts the filesystem down, xfs_defer_finish_noroll() reports neither the errno nor which operation originated it, so the log cannot tell a transient -ENOSPC from real corruption. Report the operation type, errno and remaining reservation. trace_xfs_defer_finish_error() runs after xfs_force_shutdown(), which BUGs under fs.xfs.panic_mask and so never fires for the first failure; move it ahead of the shutdown and mirror it to xfs_alert() for systems without tracing armed. Capture the op name while the item is live (dfp is freed once its work list drains) and suppress the alert once the fs is already down. Signed-off-by: Javier Tia --- fs/xfs/libxfs/xfs_defer.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 75f0d37914d5..3152acdc335d 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -656,6 +656,7 @@ xfs_defer_finish_noroll( struct xfs_trans **tp) { struct xfs_defer_pending *dfp = NULL; + const char *what = "chain"; int error = 0; LIST_HEAD(dop_pending); LIST_HEAD(dop_paused); @@ -705,9 +706,17 @@ xfs_defer_finish_noroll( struct xfs_defer_pending, dfp_list); if (!dfp) break; + what = dfp->dfp_ops->name; error = xfs_defer_finish_one(*tp, dfp); if (error && error != -EAGAIN) goto out_shutdown; + /* + * A finished item is no longer a candidate for a later + * failure. An -EAGAIN one is not finished, so it keeps the + * attribution across the roll that completes it. + */ + if (!error) + what = "chain"; } /* Requeue the paused items in the outgoing transaction. */ @@ -719,8 +728,12 @@ xfs_defer_finish_noroll( out_shutdown: list_splice_tail_init(&dop_paused, &dop_pending); xfs_defer_trans_abort(*tp, &dop_pending); - xfs_force_shutdown((*tp)->t_mountp, SHUTDOWN_CORRUPT_INCORE); trace_xfs_defer_finish_error(*tp, error); + if (!xfs_is_shutdown((*tp)->t_mountp)) + xfs_alert((*tp)->t_mountp, + "deferred %s work failed, error %d, %u blocks reserved", + what, error, (*tp)->t_blk_res); + xfs_force_shutdown((*tp)->t_mountp, SHUTDOWN_CORRUPT_INCORE); xfs_defer_cancel_list((*tp)->t_mountp, &dop_pending); xfs_defer_cancel(*tp); return error; -- Javier Tia