From nobody Tue Sep 29 08:26:15 2026 Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) (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 7DEB8417D7E for ; Mon, 10 Aug 2026 16:43:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380202; cv=none; b=CYzQiwRfskpZc5cCpmFG3tlHYbPmCNUxpWg2Wot10pucGZsuldEXJUYs9EN27xswiPL+heKgpL3ZWrWTNOypSLpA4SkiF44DCYBvRkGgAwlos80WVKrFe89CE7NHqe2wg3q7ffGQ8cMeKQNlMEMcggCfxKy/sdHehACveEF8wEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380202; c=relaxed/simple; bh=O7lAK9Itxu3BtFZebuGm+soxk8EufQFIVRqNLSr9Y0g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G/ZQb0+IFVqGbrdryS0E+r7Qk21rEDN1Dq4FBrG33uD67O0dv58Uubw/iwe/xWaD6kCPkOh5MS247cQtvrv4WW0bkS4oS2l0/nkr6vtND8OK9gRh7uN12AGx1TQFieLub34xg9uSwbDPhYqM6ihEA8/Iu9UJe2hx3wADOqquxyk= 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=fb+BNbyU; arc=none smtp.client-ip=209.85.217.45 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="fb+BNbyU" Received: by mail-vs1-f45.google.com with SMTP id ada2fe7eead31-73e516d6ddcso53141137.1 for ; Mon, 10 Aug 2026 09:43:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786380197; x=1786984997; 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=sND6wzkbiGyKvdiG9Z9kRm+epdaTPvk4GyaXe9tvODk=; b=fb+BNbyUh2xzUMRrkM5L8mmq9DQt52hI1WG0gzjNooFrJOW6FOjZiJZdVeNrw9wEZR 1TgUCjmW1BT1XJWFAHanNwxOmDiNR2KmA7D8nP5h5ADNgZbMZNmlqvHy+dyLHJXi0pEn +mUE9Dn9TkDNBjE4CTZQ8r7N1FJt3n37KMcDvXEjLlrEAuC4+7TLpemHZdEgqQPQUYXN oNq0joWB21J+kU1R1FB/OOcuLad+5bY2vEPJ1cWTF0ys0A2vZsJxxM/sQAQCSBOQ93g2 8Ots0z6igtFuBRpWDHrpMK4RgnmBUVqGOrC09MAPHltHZh/BdSSqz86uA3/V3NH3TrVA xy6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786380197; x=1786984997; 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=sND6wzkbiGyKvdiG9Z9kRm+epdaTPvk4GyaXe9tvODk=; b=Vh9D5N4pKSO57GOBemxv6HZ8hjJWeEWOTeTTFtTZSaLkFXba9C4wYvMw32J2Yn0Kpd ar66mtPeSE2o+yfR+0PTXCnwyQZ/Dk4/mkFMOe55g1wknVNcfVsbCV4NJ9UspBtP4dCv JVynSmFlt6N45zcgDCk8oODbv8+/ua6BWAOOhE9LyENE7y9V4FnVEQ05OGwJuSFgNO2M 2Df96/gQEbzOGv+wOtvN+ednIPziBjxeVMuXbEf/vXbrzhDmo/22mY0RdtQ8KcpqsDeQ X6qfBtvyXc7GItIHxPD89dyqbwTlH6h3ohQVuXaH0Gq9Cvc/DDVlm+odG9fVH2NYd7bA hDmQ== X-Forwarded-Encrypted: i=1; AHgh+Ror7UxzU14x3YsInyssqCpFHloY/ohJJ4TUZl8bUbKAtSJ4A3X/hif/Fh2v+zgOV5u1aIxuCWklP+KYBPA=@vger.kernel.org X-Gm-Message-State: AOJu0Yxa16DslmxOSNSr0v28EgYVEgVyEBQTdA9JNFPqebKOGAGMpXD0 Ysc04E2SwQQ6ufrXvLDT6lyVd2bs4ezoU82EMIwNIXQcIs37pjxmMqm0YVQU2/lcpUzZlZJWSgs A4rvhSH0= X-Gm-Gg: AR+sD13RZzakUoA6CypKKDkFxEtlBd72x4qgQyXkrh9/AuoWRcL6Bd0GGHiEjb6xGut pdB07/jVdo2MGyLX3SwwPKAK5If9jEjcArJ1A/6bct99FsfHEUXbr2DrQ6AM3VK15G+gDXdBDSJ qgk+rrp9utnRh3pN+47vEOJasgx/L8nhvn7THtXK/HqlvcnlCoGqIkvOP20OYuyrpcXnCpF6A/L fWyuZdOwIaM7RjM2QxU9Voq0h5XjW09oLyavb0P8kYLiHKutktTBaEAsXiOfDTQjklhKHAiiLrD FWGcV4nuHm/5RrMPbZp67i40AjcbbIttZQcoMf3ZUwR0Ybx/X1vgpzaMWrAeP1Byz8khTf9GeKD rrykBnGjGIDBf4OIMpH1pYhN5xOU0dD/kqMZEIvvR9CRlDfkxJbHgZlaywfXL2jUiH2QLBdx746 YIQftC6I8H9X+x1IhMyYtGBA97dRml1SdyFzmKi6Nd0l1BIIbk2lYWwA2h4ViOya6YQg== X-Received: by 2002:a05:6102:5689:b0:738:8d0f:72a3 with SMTP id ada2fe7eead31-760edc7e42fmr5605791137.4.1786380197362; Mon, 10 Aug 2026 09:43:17 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-76400dfe036sm4853650137.8.2026.08.10.09.43.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 09:43:16 -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, stable@vger.kernel.org Subject: [PATCH v2 1/6] xfs: initialise error in xfs_defer_finish_one() Date: Mon, 10 Aug 2026 10:43:14 -0600 Message-ID: <20260810164312.960721-9-floss@jetm.me> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260810164312.960721-8-floss@jetm.me> References: <20260808234016.246054-7-floss@jetm.me> <20260810164312.960721-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=1468; i=floss@jetm.me; h=from:subject; bh=O7lAK9Itxu3BtFZebuGm+soxk8EufQFIVRqNLSr9Y0g=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqef+hdkIzN6Vm6qJyjzD8yEylWzJ49lYuL+7hF mhBN6Hvjd+JAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCann/oQAKCRC17sMLqGd3 H+1yDACf56wZHP4m1Y5Uv+vxhSX72AcZO0A9l+l/pCUvABZ7e8DJfMfAjVVgcP6MKXNRxUvq/eG wnOcudsw7GhWD3fa88++G0srE3xuALcSYhbEVtSa/ZrONxsuKAV0+UVZFPwBVidfEWxWMaVfI8N zsAYzC41KkH7Kl0ssLLbhdKUNAyUHfAvyUU2iTiB3PFhpsntX6uQ2KQuj7+JngtMXBMhhEneLsv eQ2uy6J8cvXs2rmQm7AxqY8xbe+EOzKSXHpMBTC861NSxQugYgGHWKa07vAkaMdw3nhqsLHyvJJ OXPsbfdK6G12aSHqvJL9em7/LJA7z/eDYiEIyheG+j/0z/0MjbemMRRpf/A4/8sy0JJffFx24Ma opQXba+zcp+e9mXciUzc6iDhNGu3UynCtuO0wzIcaKhdT7xJ8/SpGQNbo9uH7X8IqM7cRxfDJxd m/OOYLfBJ7/ix/fTPTqKx2g6ztofRFrXs2OdvQQ32VGoPz8J6oDACVD5KxmPIC0CiGzP4= X-Developer-Key: i=floss@jetm.me; a=openpgp; fpr=9B13B20BCF0EDE23454A93C9B5EEC30BA867771F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" xfs_defer_finish_one() declares error without an initialiser and only assigns it inside the loop over dfp->dfp_work. When that list is empty the loop body never runs, control falls through to the "Done with the dfp, free it" path, and the function returns an indeterminate value. An item-less pending item reaches this through xfs_defer_add_barrier(), which xfs_reap_ag_blocks() uses on any CONFIG_XFS_ONLINE_REPAIR kernel. xfs_defer_finish_noroll() treats any non-EAGAIN return as fatal, so a non-zero stack value turns a successful barrier into a SHUTDOWN_CORRUPT_INCORE in the middle of a repair. Zero is the correct result: reaching the free path means the item loop drained without a non-zero error. Fixes: 3f3cec031099 ("xfs: force small EFIs for reaping btree extents") Cc: Signed-off-by: Javier Tia Reviewed-by: "Darrick J. Wong" --- fs/xfs/libxfs/xfs_defer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 89501e8bd2f8..843c33304441 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -583,7 +583,7 @@ xfs_defer_finish_one( const struct xfs_defer_op_type *ops =3D dfp->dfp_ops; struct xfs_btree_cur *state =3D NULL; struct list_head *li, *n; - int error; + int error =3D 0; =20 trace_xfs_defer_pending_finish(tp->t_mountp, dfp); =20 --=20 Javier Tia From nobody Tue Sep 29 08:26:15 2026 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (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 2D28B429038 for ; Mon, 10 Aug 2026 16:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380201; cv=none; b=QgujkFPZO+Oqtd9JXuY8ZzV7xJ7wJo6CP0I2tReP7l3rp7x/AkNgyIlZ5gmAZzW+dv/1wXySLpaWg1UAoXml+Y3anX/96cPk+XVFNvpacpq34GHwCc2DoomMwmkdJ6sPymMqK6jr5RTaNk1yyrMncbMC9p7IuTsNYX67ekw8nsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380201; c=relaxed/simple; bh=cN3dntYSRKkBZpxQVRebrXb/QZ7i856/vDVWzWsugXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V8VTDV/CF7IqYDW9Ptml2vbBmPy+hRC8L4P4UATLNG1STm7ilBRY31YhXqZd35jTENhUm1hUhX88yabY49GKmlfQQ1sR2EPLRK+IyStdLyWxlOrRPDA484lIoOjRZHz3RlKrH5aZL1xx0vabnJykykH1hMHegz5socfKLDRDCkE= 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=f/aKMsB8; arc=none smtp.client-ip=209.85.217.47 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="f/aKMsB8" Received: by mail-vs1-f47.google.com with SMTP id ada2fe7eead31-73a334d1128so53497137.1 for ; Mon, 10 Aug 2026 09:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786380199; x=1786984999; 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=qEP94udPMsH7DZzh3NprgOqukKgliAk1nMK36vluOns=; b=f/aKMsB8ofDNN4AmZhaYk8CV+2NQkpY7e/9T8+BqcvPjph9Nlcxih0i52yDQiYvvWW pgBlIpi1jHWILY9RoIUt4iaCDLVJpodkmGiveCKJ1v7ZsskLGtQXSIUvverqILpvUKAE t61oqR892DoAunM0El+i5VxknDK8S87hYR1SR0/ZMVwmzXsLED/7GX4oRdvrN4ocUZkD LynP8MGCTPPC6QRgB6QT0SgR74ZAGTmqCIy+g+O0rqCmLoNzkJGFjIRzcFQRD590YZUh VeNoO+iF917FobbMfwDbLyz6l+nTtdEor/i+SjE+yOKGo1qu9YKXjAqK4vZNCwW7NPEm DRIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786380199; x=1786984999; 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=qEP94udPMsH7DZzh3NprgOqukKgliAk1nMK36vluOns=; b=UsralMHb/tyJ3hw/UI1LEAN8KWpwj5QLMaZqEYYhh3Or1MdW099yPn+gBRSjb9rRPn SE/uHX+o4aDrbzHywA2JYqHcse733rD4eVKWq30IyApFC984sm85uEJZdzyDLOLzpbxC 9DOuHGS/m/IKMzr3sZehBp8MvHC/6H+ykdayynWAW90N0gsNvwlVHWP2FR0QNjlc6Rxg wAZWJlNPSj5Ieo2INUddYfhMEQmFapJZHIFL2prBz1wU8oooXjdZOouQ+wyNzwE8NiH3 yd+8DW6+3+LIqw+fk9tDe0O84L3CYp9wTMBnCV6pAIYqR+tutxT3zdKVGPwe+K2fWNGr GohA== X-Forwarded-Encrypted: i=1; AHgh+RozIlSCVwNaZmDJUAXGFkbzwVBxnCryZpoy5wb+MSsYX6A7Py9JTe5OLYQuyO1wA5aslit9FdLiqiIU+ks=@vger.kernel.org X-Gm-Message-State: AOJu0YzrkHZySJWRETR+bAiIvIRTA1uKmnZ5pub+8zKc5iKkNw8Eouz/ GT8FxeftKYyU1rgj/FIYvTzqPlWtRiAOlUNIONEn6JAbLqYSsbkpykmX0fQAmsvsQY8= X-Gm-Gg: AR+sD10FvMM3/OhlZJbux5gWtNkV+bkVEvqnS34UNFo7zk21adRXKnSDphBwJPWh0+J 9FtDuuKuoL8Mhrm1Tf3NDaZW4FGzOuHbqR31IjHGmhKNKVs635RKjwIo7qUqHpn1D4O/chAy7FG mvtE4RzxblzjrfH3FXl5ISr/chWE8oWTHlBKOu5IbTtfOfX9/Dr/RSyRAQB89uREvdwStMbc78B EB5kA1RucZ3AGD3yjz7c0efvam3mqKlJ7Jq1PxG6E3I/v2l7BAajvpIpyb3ybNaoNthkUhQ9qMN 5mIbNcuj/K+yAXVryQZC8P4ZcJR4Hc1+hjx5AzSm6xiBRKux8vjswDFlnrndviOV6n6l3Yu4cu4 4VOvsnFZeR3ixJ6mqm7X+j7peZ8sAoD27stnsc+e6InOTxCUglh3YUqYFlEJSzNs2w1+txdzsXF 8ZBuK2gv1uXs6RihCnx1DtTbJvG1NSKWlGmDBOTzDS3Xqi/ETRCMG9hhhwS6wkXU+IMYkEKv0Jp XA= X-Received: by 2002:a05:6102:3e84:b0:74c:551:54d2 with SMTP id ada2fe7eead31-760eb45605dmr6646040137.4.1786380198949; Mon, 10 Aug 2026 09:43:18 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-979f303c685sm3721486241.9.2026.08.10.09.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 09:43:18 -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 v2 2/6] xfs: give the deferred barrier op type a name Date: Mon, 10 Aug 2026 10:43:15 -0600 Message-ID: <20260810164312.960721-10-floss@jetm.me> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260810164312.960721-8-floss@jetm.me> References: <20260808234016.246054-7-floss@jetm.me> <20260810164312.960721-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=1371; i=floss@jetm.me; h=from:subject; bh=cN3dntYSRKkBZpxQVRebrXb/QZ7i856/vDVWzWsugXQ=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqef+hZqnJOJa7RnkDd+smQ6u6sTV39cbOgg3pl R42h1J2EW+JAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCann/oQAKCRC17sMLqGd3 H/q8C/4gf++xZgmHnv21fz2YCwoOa2YFWkg3+h2arEpIMhkJxLl03yDfVekOy7jqym2OH58Qhcq oDkifo144aRxquJSPwxs02wzCKj8iqc94vOJEho+aV+jDcikrDQu8Yyc9JF28LXx5jpZph+nryQ uTrSb7sp/SH7p5YYBk6o/H92+MI2nqqq7dmiOfpBON18iaFXOVf+gGfA8cBiIYoRPOb96anipfZ E7whd6HhO8t8mKrcFIzlKEKFf2Wht8UqB1qKxSFdB4AJ8X8yqEKzZwpDzAbh8DgaDSJBaa954HP aJ6Vbc/VGp+PA7wofqCAUHeDGGgL1ccH9zsoy4zHkeaaXQd8IPk7Ay3cJ6MhBKm1DLuBFv03s6m hd2yxeXfGODmdVNV2W+PnFQRZyiDB9j7Bbs3wQ9neb5b0lqn7FkovSD+fbNOMLBOqYqLvIjQcr7 OTORWrqIfGzvigmxCnFDfqb5x31W6PjIqwHAKsSNi880QWWscab6klPOYVaotf12Unmt4= X-Developer-Key: i=floss@jetm.me; a=openpgp; fpr=9B13B20BCF0EDE23454A93C9B5EEC30BA867771F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" xfs_barrier_defer_type is the only xfs_defer_op_type with no .name. Every other one carries a short string used for tracing and reporting: attr, bmap, extent_free, agfl_free, rtextent_free, refcount, rtrefcount, rmap, rtrmap and exchmaps. That has been harmless because nothing dereferences the field, but it leaves a NULL in a table where every other entry is populated, so the first caller to print it gets "(null)" in the kernel and undefined behaviour in the userspace libxfs build of this file, where xfs_alert lands in fprintf. xfs_defer_add() already treats a missing member of this table as worth shutting the filesystem down for, so an unpopulated one is out of step with how the file handles its own ops tables. Signed-off-by: Javier Tia Reviewed-by: "Darrick J. Wong" --- fs/xfs/libxfs/xfs_defer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 843c33304441..75f0d37914d5 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -229,6 +229,7 @@ xfs_defer_barrier_cancel_item( } =20 static const struct xfs_defer_op_type xfs_barrier_defer_type =3D { + .name =3D "barrier", .max_items =3D 1, .create_intent =3D xfs_defer_barrier_create_intent, .abort_intent =3D xfs_defer_barrier_abort_intent, --=20 Javier Tia From nobody Tue Sep 29 08:26:15 2026 Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178]) (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 034A63E3159 for ; Mon, 10 Aug 2026 16:43:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380203; cv=none; b=R8/wh5EaqvgfiVSJ6xv1FU4mMgoKycHmyWUAv+zYsmhAOl/RljmqP0GXNo9BeameqkDzL+wVAwMx3wdkyZVSjQW0iVa3uy3MZlBOFrogzzqGCixGtPrGVL8ZSIplxV+lCVcE+gtpJkPGiubFIhtGNKzHLmKV643vix5Tk1YjW1k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380203; c=relaxed/simple; bh=sZmYt2raO8VdDm+hOpYDP0ljGepdC6gsEluhTLQWHd4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i1RYnnz1tQchYscjjND/mCIotg97U5/CJL4XnZpEoO+NejhHCNopXq8i7DPQkN4V0q6ecpkboS7THEHzMHIMZwEMC808qvXY+NTlwmu0U8sOqJPl5M/DEYf13pA9OW/lce0888H+hP457uxJZ6ZzZXb724M/hnOpZmgrD/5R9a8= 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=qowcV/X1; arc=none smtp.client-ip=209.85.221.178 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="qowcV/X1" Received: by mail-vk1-f178.google.com with SMTP id 71dfb90a1353d-5c3a84d3739so66254e0c.1 for ; Mon, 10 Aug 2026 09:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786380201; x=1786985001; 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=Nyeyac7LrDv4OnnnUjx1xvNsyZmRbR/sEbRM05AokQ0=; b=qowcV/X1uj0dh9ECDAw91GFIvBGPaNAff2rlFNoo7Dh93adG7G59GHLk0GRnZBUTbF CMoUFnMnbBJOupcCNC+uGs0H0zN9vVNUUHa+IHzScZrQrpbBore2LpDE+2lmZbUqMkFy 5AxYHBKOsiaHHZOrxqVEqfqcQwkDaCgOFlBVwCLnDGe2tS9fIMDUACLllUfd8Oy+2dgD AMrMbYLiiG2hPdhwSDIomN61f7enYdgsQ96HMhMHvxyNR/BBEzJ6JZ2Hq1+H3PER9ub/ NVnmMjRIninOnJ+yd+9Oi0CkuCxcOcCmlKhA/n5GNPWDp+R9CwczqSyrDlNnl0O1dp8j d9uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786380201; x=1786985001; 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=Nyeyac7LrDv4OnnnUjx1xvNsyZmRbR/sEbRM05AokQ0=; b=KVOuNX8oVLaN+pfXRg8n26MJqXC/RvFprIHpy7vMdILoaWlFrgJ144S76Ra/hsUeB6 4UGLQYXV3RnH+vjXgbuOkTTKwfgIDbTBSJxEctULUwdyBmH1LOUO18z+PeHIzjOSAIWt ngAX7SaWUVqMOv0pIq0j0kAvy3GeFMi0Q/aFqemcCWeSy3zYeBsld9fNZQ2A/rv2XnIk KhKoqU/8vPHw/Pvt7h9KB3nDBevcWZMwXLmGHcoV1V0c7Y+EhU9ubgZI9ecY+siaD+W6 YltyHH14HsLEVmMcxN0wbmUAhIZ/Z1qF0LUZyqVs63mVHoscmbfKsoAMjNVuOjeEWnfE bv2Q== X-Forwarded-Encrypted: i=1; AHgh+Ro7m21grCg6lL0INIWfzVldc+akeIrbkvssbqI4RLcWLe/TLnrspTr2GM2oBaYk3yVYKwfLAGMdz//wPzQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyFC5AtF7KrYd7dqoiuimB0GwhE2J9eSRFcB/HkX70Ms8LJbcn/ FHzPAqcJbF3oRnQPxXCKpD4RIKSVTBC7mdMVESeVffPbmY1zNMhWO3lz1KTlxbgIQ+U= X-Gm-Gg: AR+sD11ZMeptty+mU5TyyXMunldPIjTTChzZRHFFHyCDvI2vLlW6JfGDhHkVk/g96S9 ZB1PzxihDrvsRortU1QdPpLpmUKMuin7N/rekZh2semq0uDms309gykj76FqmidgQFTX8viSxS2 OOIG83MyZtktn0Da+VoTeQ/Zku4rOfe+n0CFEJAtaDpoYws82AW0LJ0x7ylOMIWscfSIDrRb74O vaHz6Bk+Pr7kkVcd/OrE8AemdDoYF/+gVRLxka3DXhtF4s6KLTwQmb+m/7PSqCEeM8Q+OLSo07r Zikxpbx+xcaYxhSnlW+BBRUoLXNoWoF3gR8s5VVnWrm4Q6HUwbDiWjdBKlo2vnCsmn4smBFKyJi 4rFOZuhqTx2ZHgIcEmSWHa2Dw9osKl161kfVlaOoxP1SpTFdpnk4HDw3Fs7fChXmsrN5Pl+kg9w 45jCatTcrISpvuYbWQSRuJxIeIRLfi+DjkstFtv823Ziu2Dl3lvXDhK64= X-Received: by 2002:a05:6122:c288:b0:5bf:73a5:3e05 with SMTP id 71dfb90a1353d-5c3d927a735mr3088839e0c.3.1786380200754; Mon, 10 Aug 2026 09:43:20 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c40b1aaafasm4503614e0c.9.2026.08.10.09.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 09:43:20 -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 v2 3/6] xfs: report the error that made deferred work shut down the fs Date: Mon, 10 Aug 2026 10:43:16 -0600 Message-ID: <20260810164312.960721-11-floss@jetm.me> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260810164312.960721-8-floss@jetm.me> References: <20260808234016.246054-7-floss@jetm.me> <20260810164312.960721-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=5410; i=floss@jetm.me; h=from:subject; bh=sZmYt2raO8VdDm+hOpYDP0ljGepdC6gsEluhTLQWHd4=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqef+hWc2ucnGB2iLvPGY7GFwsoX7z/tvck4NsP BrXDiEHud+JAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCann/oQAKCRC17sMLqGd3 H7lWC/93Hf88PQ9bhf2CtTxEr0K7yd0xz8tsq33Rs32dpi8+yHBi0q06Eq2nHm3UkYu8BEeBtSW ZMrSUuCLCOiwTggHu7Pa3xcSXSQJUUpjCoQAivN8nkJULpKzsgROklkaW+G7SbcCaBDWBVKmK9k FhqnjY+ZXDYtFfk1NmcdE0hzlQqXLLlQabvb2TGXPEuikC6sixNquj5gYDdH2+/rodTclTmTcD3 6iwGC083Je7JZQwxAcwoS1m3mE5fFZwVIGLboSZPwsQKNozWnQPHh8u0RXdNhP3g1+9ob+vsJXq fau79caz4v3VHiaLyXipTg7fHVfMxlDx5DfRQQC36YkfkwaRKXH5t2jrhd9WsYq7Id72cmSEmtO eC3xPX4SmoM3tiZx67I7hMjEPq04pu4mSRyNrIY51C2y/PH/wX9v3lybx0eJdjAaIv5T+wyTvoS 013JLtcNnWi4Gc/mAUNwItQfQKlbk31KOeVXf3GmuLM0W9DSJmL5AspdpCzALD03K+HOU= X-Developer-Key: i=floss@jetm.me; a=openpgp; fpr=9B13B20BCF0EDE23454A93C9B5EEC30BA867771F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When xfs_defer_finish_one() fails with anything other than -EAGAIN, xfs_defer_finish_noroll() shuts the filesystem down from a generic out_shutdown: label. SHUTDOWN_CORRUPT_INCORE makes that surface as "Corruption of in-memory data (0x8) detected at xfs_defer_finish_noroll+0x29a/0x4b0 (fs/xfs/libxfs/xfs_defer.c:721)", naming neither the errno nor the deferred op that produced it. Any error from any deferred work item lands on that one line, so the report is equally consistent with a transient -ENOSPC, an -EIO on a metadata buffer, or genuine in-core corruption, and there is no way to tell which from the log. trace_xfs_defer_finish_error() records the errno, but it is called after xfs_force_shutdown(). With fs.xfs.panic_mask carrying XFS_PTAG_SHUTDOWN_CORRUPT (16), the first shutdown reaches _xfs_alert_tag(), which BUGs, so the tracepoint does not fire for it. Later racers do reach it, because xfs_do_force_shutdown() returns early once xfs_set_shutdown() has fired, but by then the errno belongs to a secondary failure. The informative one is lost, and that is the configuration used to capture a crash dump: recovering the errno from a vmcore means an ORC unwind of the xfs_defer_finish_noroll frame to read the callee-saved %rbp that happens to still hold the value. Move the tracepoint ahead of xfs_force_shutdown() so it is reachable for the first failure, and report the same information through the log, because the systems that hit this do not have tracing armed in advance. Report t_blk_res as well as the errno: how much of the reservation is left separates a transaction that ran out of blocks from one that never came close, which is the difference between suspecting whichever xfs_*_space_res() fed it and moving the search to the allocator or to the buffer that returned the error. It cannot say more than that, since xfs_trans_dup() hands each rolled transaction the unused remainder, so a small value is also what a correctly sized reservation looks like several rolls in. t_blk_res_used is not worth printing beside it: the new transaction starts at zero because xfs_trans_dup() allocates it with kmem_cache_zalloc(), so it reads zero on the roll paths and counts only the current segment on the others. Take the op name in a local read before the call rather than from dfp afterwards. dfp is freed once its work list drains, so the name has to be captured while the item is known live, and it has to outlive the item to be available at out_shutdown for the paths that do not come from xfs_defer_finish_one() at all. dfp_ops points into a static const table, so the string itself outlives everything. Clear the attribution once an item finishes. Three of the four paths to out_shutdown - the create_intents failure and both trans_roll failures - are reached at the top of a later loop iteration, before any item has been picked, so a name left over from an item that already succeeded would blame it for a log commit that failed afterwards. That is worse than the generic message this replaces, because it invents a lead where there was none. An -EAGAIN item keeps its name, since the roll that follows is part of completing it. Skip the alert once the filesystem is already down. Only the first failure is informative; everything after it is a consequence, and xfs_do_force_shutdown() suppresses its own message for exactly that reason. Testing xfs_is_shutdown() rather than rate-limiting keeps the first report unconditionally and drops the ones that follow, instead of a token bucket that could spend itself on another mount's failures and discard the one that mattered. 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..bbf2f4ca3c2e 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 =3D NULL; + const char *what =3D "deferred"; int error =3D 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 =3D dfp->dfp_ops->name; error =3D xfs_defer_finish_one(*tp, dfp); if (error && error !=3D -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 =3D "deferred"; } =20 /* 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, + "%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; --=20 Javier Tia From nobody Tue Sep 29 08:26:15 2026 Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) (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 7E3C242A158 for ; Mon, 10 Aug 2026 16:43:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380205; cv=none; b=Tla/umsEvCfMRreKbk/BD9feNJWFj92QJcF20iinHAOCUzNQbryPnSR+veADOAkwEC6AJV9jnLKmkDAj4pgtqGxYSD7vpiB5HCsq06k+0fGoG45Zy+Qhi+wMELfQBEyGO/LrBCR4wTbJt2ej7vOJif1T5V9qo1Sa23BB78s3PkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380205; c=relaxed/simple; bh=NNh5aG4w7LlGxuf1r7SXWUFUWOyJJe//FeT84ioNlzE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nD3o2uCvvVFLD300+56BVIeE0oeRCGkabIc3ZB6YxUTh5sMoXmS9DlUMKQh7kGcSVmPG0P1fusmUncBzPhgnFPFBcVSUQgqA+M7RvOOsOIoC5cFk/Bq7VkrgQD7LITrSgKvnl5XTCgQdgE5r2UugIhNyz91UV/woa7vo3qIk2t8= 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=oxbg196x; arc=none smtp.client-ip=209.85.222.52 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="oxbg196x" Received: by mail-ua1-f52.google.com with SMTP id a1e0cc1a2514c-977be90df26so47848241.2 for ; Mon, 10 Aug 2026 09:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786380202; x=1786985002; 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=wbXsisKh0qf4tkJequwBHZTpDXZaOCmKMrgCvRHqAvk=; b=oxbg196xPXE/kZhUuL8wHH51+vPjxwO5XPKHkpCBDe1CLdF0PEGmcwR78v6YDJBkVK Xxxhrc5uAo0Tvrl82jxmXOaISWQlodId0uvnGMFApR++kqBAMa7U1Xtenltfz3iJSBqK UA1DUD5VFMFTbdx6g0HssvPDkFXli15/VjqCTq81eOhlleuo1aAN97vUmf2JkRZEkUMm 8vxzLqNYTpZ/OKZDkmeseD1mLzpl07tILTmzu0bozjKSAfrDyHShQtMwPfb7tFKXn+Xh SE+JqETML4tZIxBHRnyAlNz3fBRJiPJ7YNM++WTfYdofGr8DTKwzoive7CrShvFGiqu4 QlIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786380202; x=1786985002; 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=wbXsisKh0qf4tkJequwBHZTpDXZaOCmKMrgCvRHqAvk=; b=h5NnJHa9NzSu2BKIIsfAG2iyvYaT7O2N1+1nM85V3nbO+ZNaaon8ZdpsxYrL3nBxCP ldxHF1pnkqIsyC8jggZ1uJ9KMEoqbLFtUY5QofqbFAXWfeheV+bZZ4tPTqETBcYBhQs2 6RZ+SEcVFg6SJPorYYlRXv/56h6W/9bJhpNjzJit9CMU4kW537bEfYyJahXfeE9781hC W2g8tJvkdxIATw3tcUNMSX39v4KD2Z2vxpUxJAY8JZc9b22F9AXrrLys+wcPW9PtVHoM oavRdywjvPcFEgEqPqnhNoAZu40QJUqNrywFGL0jhiH+ZrE/Q+X4/YhkQBdxDVRApzGl 0+aA== X-Forwarded-Encrypted: i=1; AHgh+RraGKuDxG8Xr4b7Gvcrd49XCOfFUG7FyQ26ZWpjXKLVIVyewCCmnAQt5NGKaJNI/WCNmBzYNGe01804G0A=@vger.kernel.org X-Gm-Message-State: AOJu0Yzdi0jfQTI7BPrJXwVDFgM+Ek8J2/NxfgOuEByGPGVovgO3PsK4 YL7CjRg/MugGZnglxB9955VAJGqNENEieylGAxGyu7NJuhb5N8bncbN0DwvPQZILmZPsd4A7NLP itH11LN0= X-Gm-Gg: AR+sD128rt313XkZsaOawwC1MobN7h3nRDJ3G4hghgTp1aNbqLW34QapBscSVgdxAjQ xn1DhDOZ/0VQRWrmn0EJ8ewPhV0exp6+JFbYWymJITTKLjwLkS/c8rm+hOg6SqtHIV21urBeGwG VRcoHOwrGi2exfY5T1ZkErd/ap9O92IIsrbgd9DXqfTdWhayhypsGH/Ety/PJrEx4HUyFw+Gzux O0tWmSXuSbS5Tp7Fhs2QH94q8qLnFpABv3mmBceSbhez1Ox8MabKzySdK3Z8QUxk6WAR0stlna+ 91v6jJm8ax3edM0LWGG1+L2AT4ZaBc4UOKSsYr7FagJvQSU4dNOYnVhTLJ4vKz28L87SiV4aCRG kdwrEufhewIZSGSBBUg/t0VLRptUkL3MDe0wE9mKqVv0/GuWpb0P/8jifXhL7Xpt+R9Bj+EY58/ +RXPzj7DU1bImo30xJ5YIVq3IH5vb+EgJU/aJDdX/xX+Fz+oUBdMYlU9k= X-Received: by 2002:a05:6122:8001:b0:5c3:b339:7b19 with SMTP id 71dfb90a1353d-5c3d9089796mr3473437e0c.1.1786380202345; Mon, 10 Aug 2026 09:43:22 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c40b1a8007sm4686085e0c.11.2026.08.10.09.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 09:43: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 v2 4/6] xfs: correct the parent pointer space reservation comment Date: Mon, 10 Aug 2026 10:43:17 -0600 Message-ID: <20260810164312.960721-12-floss@jetm.me> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260810164312.960721-8-floss@jetm.me> References: <20260808234016.246054-7-floss@jetm.me> <20260810164312.960721-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=2488; i=floss@jetm.me; h=from:subject; bh=NNh5aG4w7LlGxuf1r7SXWUFUWOyJJe//FeT84ioNlzE=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqef+hTRG87aijZKn3RyqSuNdDpFcbWIcNNA3Fv LL1n2VxtmaJAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCann/oQAKCRC17sMLqGd3 HxirDACZiE3oq3uoauqJ//X0CoAHzdyr+NN9AbCLlnXPaoQvfPLiUIJuQhYSs7zDzk4ojnKj1+5 n0g8GTC5FI33786Pfo/l0L0ilVna1itTy50uGgOC8VmcbncljswJu0RZDgX41aF14yGRjSbWARu Od1A9qztllg2XQMgmVxqj13srswq56nvrT2UtgKahfkvAAUte6C9mJL/731CE+D/zzV3obvIRVm N+DOxOAr+4HZl1RlXo8i1vy3oRtG4bzjk0H0XiSr2FjeqoXOAy2bgxPAuWSp7vMMu6pT9iZtpkV vQAFnUXo/g5k8lI529FuPw3pqkHF6QamzOb/ryMu6hIWlTM1y7WCZj4V/NhjsdBLZ3wIsWOlKfr cdegsBU4WVJAcxfCv478x1corFNA61HE9s8YQlUUuycvEX6uY5HAe0NtyIaSf8JQB1BDwDyAL5c 9uP7ccQzSknOU422CtmbFfMaqlhnCbHqZygTu1CvsoVFPU9t5yWkwLrOrCignY2058BJI= X-Developer-Key: i=floss@jetm.me; a=openpgp; fpr=9B13B20BCF0EDE23454A93C9B5EEC30BA867771F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The comment on xfs_parent_calc_space_res() claims parent pointers are "always the first attr in an attr tree". They are not: a parent pointer is recorded per dirent, so by the Nth hardlink the attr fork is already in leaf or node format. The reservation is still correct, because XFS_DAENTER_SPACE_RES() covers a split at every level of a maximum-depth attr dabtree whatever format the fork is in, but anyone auditing a shortfall here is led by the comment to look for a bug that is not there. Rewrite the comment to state what actually bounds the result, and record why the double split allowance and the extent-add term differ from xfs_attr_calc_size(). Signed-off-by: Javier Tia Reviewed-by: "Darrick J. Wong" --- fs/xfs/libxfs/xfs_trans_space.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/fs/xfs/libxfs/xfs_trans_space.c b/fs/xfs/libxfs/xfs_trans_spac= e.c index 9b8f495c9049..c4cd547033e5 100644 --- a/fs/xfs/libxfs/xfs_trans_space.c +++ b/fs/xfs/libxfs/xfs_trans_space.c @@ -22,8 +22,23 @@ xfs_parent_calc_space_res( unsigned int namelen) { /* - * Parent pointers are always the first attr in an attr tree, and never - * larger than a block + * A parent pointer is recorded per dirent, so an inode with N links + * carries N of them and the attr fork can already be in leaf or node + * format when one is added. That does not affect the reservation: + * XFS_DAENTER_SPACE_RES covers a split at every level of a + * maximum-depth attr dabtree, whatever format the fork is in now. + * + * The name is a dirent name and the value is a struct xfs_parent_rec, + * so the leaf entry is always local and never exceeds 272 bytes. + * Parent pointers require V5, hence a 1k minimum block size, so the + * entry always stays under half a block and this needs none of the + * double split allowance that xfs_attr_calc_size() makes. + * + * The second term hands a byte count to a macro whose parameter counts + * mappings, so it asks for more extent-add allowance than the single + * mapping a parent pointer adds - how much more depends on the block + * size. It over-reserves either way, which is why it is left alone: + * correcting the unit would shrink a reservation that is only generous. */ return XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK) + XFS_NEXTENTADD_SPACE_RES(mp, namelen, XFS_ATTR_FORK); --=20 Javier Tia From nobody Tue Sep 29 08:26:15 2026 Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.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 388AB3BB13D for ; Mon, 10 Aug 2026 16:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380208; cv=none; b=OYarls9ibnkzN8PpmeQsseDQLdLVVI62lxQnoaJTdxlmRxYheh6Uo+B1+96v1pp64Pwf0euWOpcDVumX3vcX54xz0swTCU2gLeV9E8EGCBG1l1lw3RBYcIpV6q+yIGn6XgMWLZPqiXke2yhFy1tJEQhxwBercyNZZ7PUSeL9A00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380208; c=relaxed/simple; bh=c4fSmyNB4m5oQ8lZfExUsQGukvI1B3sAmLc9u8/mj5U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vCJlHPeT6IAIXhl8WfZUOXl+Rb9uDDtHEx/gvIfnNjEAD7VxMrZRFjtUW6T4DOc3r/FgjygwFbZAqDVdGHbw+5g/F6MbLADUyoS/br0XXTh+lvL1kS1S8iKIclI4PNaISXHhr/WVeLIz9k0sWP2checNh3JOnqPDXVfWV6sGCtY= 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=w+WbApYe; arc=none smtp.client-ip=209.85.217.54 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="w+WbApYe" Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-7395b602bb9so53018137.2 for ; Mon, 10 Aug 2026 09:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786380204; x=1786985004; 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=xGxAii+GkeS62oW/NXkupU8ykf66W6U2MtKUhTFewv4=; b=w+WbApYee2JVL3BDvw+cAmS5dYbL5IY5mKFDHHJNvNtr7340ugFW4ElG9fD5Bk54Hg uE6r37hzhUX/Ob8r5FJ3HbdLoY2LW1NecBF7kt3dOm0MkBYJieqF7DMYst2tVn4cnpIK NbhEKRURpQZn5XfY9XypZvt2k7X+wIcd+B5ZhpvM0EgF7f6C3A5fBX5OVD83E3NX4Z0E p32slj20OL0D+YrlfDjIiK2h4UH0SIJ4l1neCLyj+9c1nVj+TY6G/OPB+bhw/9zgOcfu JO4wMkrd1oRa4Bsf3A+S18azyg12uPnkj5ytIy7ORLrRHahanRGfSobBbt90ZSnvJ4LE kAiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786380204; x=1786985004; 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=xGxAii+GkeS62oW/NXkupU8ykf66W6U2MtKUhTFewv4=; b=XjP1IBMMHmYBVPoyAA+hRjakTqqW4Q2bbM6nhYglA4jvcMrLyDSnWq/u6uxPgcjnd/ Vog8t/gkGmb8b+SFhj/APvcEOeEAeVABHTfeKSfx1Y5K3aYLnfAnB7do7uXrTdu6HnH+ C9CN9V+PMqoPKcqi2LbZtY2pzj4Nf6JG25PBl1yCrSed73Z8E470UE8BtUYL1/rAGmGV SXxC9jBhWJTj9nxr9PZkTyq8GncgC0jSUovzkhUh+XMkBR+ze+A4LXRhQprn+8P73Ovg iA7LljZZcXG7MdPBlJSz3WVUp5Ei7UMg/orRtCdKQ/wmYlMYMNcNdsi6dYjkeJemKXtc LMAg== X-Forwarded-Encrypted: i=1; AHgh+RouCB1QtVn/+LZPd/JX6HeAFhyELAe0j8VEtEHONfJczHIC/Rn3GZtPfEyVr+3e+rPNS9iekiPNntxFrMI=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1V8vx9bqcB9ldMmDEzJLjGIk6Y4LWd8OhFJE6nlmSB115ihg8 todZaZuVnxSdPBsOyMtRSs/RQPEd2aazwmnBE0WYJy2kzBr0BWRDqD7VsC4HCSJRdvw= X-Gm-Gg: AR+sD132KHYmyVXOIRn3PawPNdfJJF69bCatZ1IROgQRZtG7MAY4nircxkFVsquiI0O 4XNPNcldrvhvXHmMCUuke7RWsw7ufotkJ93aVVs2AiaY//+0Zsg9j0b+Y431N7kODkgZ1K64c0+ 1DQF7YpET6KC3bJ4xvfUpE8DjNAL/U1wAe28hQoGK1BLiR8TTpeLJ/Jl2g3KjRTBbQpaLXLAgYE vqIH8ArQ1G0ued4VkLJ6dLoeZHUTlS0PTa2qszFHOjhhESjRbrwIIJ+irk13jpg/kt4PLJR2lpi G6PR/KBfnvRUT+YypzVwOXcCVkXte6SX4LuVpOpfh1hFVWkMMK9iopZlzaFhFHmBCfpzGUNAIEj ljjaewKnj/tdXp5WKHTTjkZZIbYJe0Zpe1WemBHZ/agK2dCBUgkMpL1mN/tfOec8E/tcc68VsDh k6sMvye9wTti92jtxqdip1AtoeWduF1BKAeixh3Kf+kmCkmSe+7QJJEjmRx6+Cy9+9 X-Received: by 2002:a05:6102:3ed6:b0:738:9abd:9ebc with SMTP id ada2fe7eead31-760e79e969amr6371775137.0.1786380203875; Mon, 10 Aug 2026 09:43:23 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-979ffbdd8besm2934121241.2.2026.08.10.09.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 09:43:23 -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, stable@vger.kernel.org Subject: [PATCH v2 5/6] xfs: initialise args->total for parent pointer updates Date: Mon, 10 Aug 2026 10:43:18 -0600 Message-ID: <20260810164312.960721-13-floss@jetm.me> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260810164312.960721-8-floss@jetm.me> References: <20260808234016.246054-7-floss@jetm.me> <20260810164312.960721-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=2476; i=floss@jetm.me; h=from:subject; bh=c4fSmyNB4m5oQ8lZfExUsQGukvI1B3sAmLc9u8/mj5U=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqef+hRIGiF74Jb6/aVidlMF/bNycp0hpb4sogI TuDxy05+peJAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCann/oQAKCRC17sMLqGd3 HzF+DACSYpq5TFDCIpcKCPZrDIPpswdfRaDz72dOdUR0qFUfFSm6ke93hu1jeluazL5nTIe9PNF ZPyJfNxNBSw2ECWhd7qdY4TRBooGXvKPvJtLH4M3V24m17NE6CRRPgwfFWxw62xCRVHOAIO61CO YnwTGe0AFpoJtPIJVGM5Gn19FVWEdf1d1HGXCN0StGVStKlGoHC6GLjnTZjx67Z6d2APLI3JjCM 3bXfgTOR8ou/qleyn15ey/0hNkABgIBvuQAZbO4nD0JBKsUNjAAW90f4xBtCKi3jfhNdZh9j4m1 fupLiN5V6qwb9gRZ5U8D4qoVmhz/TITUu0kRCKeqWhyHrbN2v8IQo0JP7imyGHNngiuIn6pmNB3 Y1LdECJSvj0CvOmvrOO8Lx6HAEFIOIvfWGaomaZGRNTmOVeEC1EOY9NLtF3TyKW/XYoiRUJ1DCF PAkyQx5WDlLEWoAHt9PvtpsVBsha58N2bRCWxRLNCWx831oEHZDIQxzs2jZZc5v+U1Z7s= X-Developer-Key: i=floss@jetm.me; a=openpgp; fpr=9B13B20BCF0EDE23454A93C9B5EEC30BA867771F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" xfs_parent_da_args_init() builds an xfs_da_args from a zeroed xfs_parent_args (kmem_cache_zalloc), leaving args->total =3D=3D 0. xfs_da_grow_inode_int() treats that field as a running block reservation and subtracts from it; because it is an xfs_extlen_t (uint32_t), the first attr-fork growth wraps it to ~0U. That defeats the free-space check in xfs_alloc_space_available(), and when it coincides with an AG that has exactly zero available blocks the allocation is clamped to maxlen 0 and returns -ENOSPC, which xfs_defer_finish_noroll() escalates to a filesystem shutdown. Set args->total the way the log recovery path does (xfs_attri_recover_work(), xfs_attr_item.c:706), in the add and replace paths that can grow the fork. Removals and lookups never grow it, so they leave the field alone, matching that switch. Fixes: b7c62d90c12c ("xfs: parent pointer attribute creation") Cc: # v6.10 Signed-off-by: Javier Tia Reviewed-by: "Darrick J. Wong" --- fs/xfs/libxfs/xfs_parent.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/xfs/libxfs/xfs_parent.c b/fs/xfs/libxfs/xfs_parent.c index 3509cc4b2175..312f33086d53 100644 --- a/fs/xfs/libxfs/xfs_parent.c +++ b/fs/xfs/libxfs/xfs_parent.c @@ -194,7 +194,7 @@ xfs_parent_addname( const struct xfs_name *parent_name, struct xfs_inode *child) { - int error; + int error, local; =20 error =3D xfs_parent_iread_extents(tp, child); if (error) @@ -204,6 +204,10 @@ xfs_parent_addname( xfs_parent_da_args_init(&ppargs->args, tp, &ppargs->rec, child, child->i_ino, parent_name); =20 + /* Growing the attr fork needs a real reservation in args->total. */ + ppargs->args.total =3D xfs_attr_calc_size(&ppargs->args, &local); + ASSERT(local); + return xfs_attr_setname(&ppargs->args, 0); } =20 @@ -240,7 +244,7 @@ xfs_parent_replacename( const struct xfs_name *new_name, struct xfs_inode *child) { - int error; + int error, local; =20 error =3D xfs_parent_iread_extents(tp, child); if (error) @@ -250,6 +254,10 @@ xfs_parent_replacename( xfs_parent_da_args_init(&ppargs->args, tp, &ppargs->rec, child, child->i_ino, old_name); =20 + /* Growing the attr fork needs a real reservation in args->total. */ + ppargs->args.total =3D xfs_attr_calc_size(&ppargs->args, &local); + ASSERT(local); + xfs_inode_to_parent_rec(&ppargs->new_rec, new_dp); =20 ppargs->args.new_name =3D new_name->name; --=20 Javier Tia From nobody Tue Sep 29 08:26:15 2026 Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (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 770DF429034 for ; Mon, 10 Aug 2026 16:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380209; cv=none; b=HTjeejDAX4yYzPVuSj8Oi2Xf7ZRU0wCX8Z0hypNTGcIN8MMht524l7ogeySRwOpkAk2tyqqwSYv74FCKwxT/AYwr6/z13VP9ZkSwfEYnUBMSdKNZfMRdW3kaCkYqRLL+9NKKqLWmlxVY/ODFwhpiKEfa6tRooBeMtTpPv8p8+cI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786380209; c=relaxed/simple; bh=WUMwcYpE3AS+4QjuhS/jgyUS/yuSPcI3ZCY9XCLDSrY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TM44EpzGrwBRVQvtIUayaXQh025+7qEJzk0gaE6Xey4YLCk6mivgyevHK1uN7WFVS1BhH9uYmRcZ20UfYObN5IhLUBPA5clzutGawRnm4bd5KOG18p4vhiC8BH96nZZ5BxZsvLR9X82hMiE4a8qGkUzz/U7/Jrfj/jpADf4lVgM= 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=RGH0xXQ1; arc=none smtp.client-ip=209.85.217.44 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="RGH0xXQ1" Received: by mail-vs1-f44.google.com with SMTP id ada2fe7eead31-744ca620161so51416137.2 for ; Mon, 10 Aug 2026 09:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786380206; x=1786985006; 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=7FI9sV3SC7KIDrqjsYK+ZGfiq5bL/Z0zCXvO/BalY2U=; b=RGH0xXQ1NI1cBl/1QPyLdKnEcRbZPbpysJi1+7OUmr6+U/bEbVThLuU32ZlKyGnMXJ Fk8hZBm4YIzNuNIYHG05D3p2Bu9wylE7P9TG+XJcFxlgCz6AfpIWDgOMzU9dLoJq5vaF pqb9PU+OkkAmo56G1Rexvm6do4Dvy9th2/+BC+126CZUdK/44+RKeUZkPL0G7H4a4Edf PsUK+sUkp274ah+cDVGHt8BF0iBv9eJjCu7fcxD52WSFgy8V6zsT2n5QuF/l93hMIJNb LNATutxVzqxqn2vEsdI0eia/J17zqFm444DDxONExb56fjTuhy4wyb1Yt1xQQfghQM+2 C0kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786380206; x=1786985006; 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=7FI9sV3SC7KIDrqjsYK+ZGfiq5bL/Z0zCXvO/BalY2U=; b=EdMZNEDoLthicxTfeRba+o0pA0VcSUPyTRk2BWbRbBkgF5nbeCnhZ+xGZybYFrD28a /tX5xaYzFdB1tIe0WUk3EDWHIB7kE5JkrblUWXuO9I5vEHZLijtL24rHqFATKgmp7W26 1BOPh5N4tYDASP08IkumT2CoYBIiplvUXct7uFML/UbZ5HfPCUUehl5xodlPhMvp5mhM kfWIsuLh8nnhKP9ls/9WL2QHJ4kNq6VtfFIRJaL5N7TJaNqktI53uRJj9661a0Cn2LEe StAQTAbByxDI3WEO7MCgxqwh4Dd+8BjBhH+IzL+k7hMELLBBnGDoyaDPIs2Sh70PtRJa 3ATQ== X-Forwarded-Encrypted: i=1; AHgh+RrCflqSmttf3z+RpCe/Wbrjd445FQKHcAj29QMXoB5WN5nCFDs3F5HEG5l/PJ7quvEmfMMVIA3eHkI5UgY=@vger.kernel.org X-Gm-Message-State: AOJu0YxWLslvmflHQMsJoANLmPzNdzaiCv+r8C7Z/vN+h/pNao9bINFw 7COsjhiB5F/t/rwvjNrBnsFOrbauKN2nTEOcSPLBnw/G+q8XWVdAOE8spOVDaw1hmvQ= X-Gm-Gg: AR+sD135VG+aHFWPC4S/rYb3Pev+IjAgOZv7SoXTNqHVeQgFw5ZkHFwG8e1SFjM3y3V touV59Li5PZXTsYKyYRwdmNFXH5a57p5Vt6ffC+5nFdGcNYVsyo+79iGHb5NOPvRxnVnDpxcTF2 /BbYD/SxVR2Tso89PfgTTa8S7LscybJ6o3lbLpgyE/w83kZ1J49BTCpRVez3+5lZaD2sFY/87qw 47EZpYDN+vR9fHUqrQ8Y1HKFrEGUtsqVkFWnHO1dxYn0LfpcRMNcmL4qhtfRdbBFW5PO6/WBKIK mzcoS49Nf4Tbl0kiK64K+q66gbbJ5u2bA3dzZX+LKRxKs4iuHGSX8EvvfcsUGgqsLlWwPhnQiEk qK7uupRP7iq/m/DC/SnzmfXp/fKdkBWCdcTm67GDlgh8VxoRd5/iHu+yG5/AZspdwt2cgKQP4x8 nOTCUn+tPkHqpDuNYcNjBxJ+4J8EXF9PodkOKMBfTyXeCw0g5KXwjuzrCW5xJ6cr8s X-Received: by 2002:a05:6102:2c16:b0:74d:ce65:3e8b with SMTP id ada2fe7eead31-760e9045be4mr6624544137.2.1786380205646; Mon, 10 Aug 2026 09:43:25 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-979f303b72bsm3554691241.8.2026.08.10.09.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 09:43:25 -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 v2 6/6] xfs: assert the reservation covers each da fork growth Date: Mon, 10 Aug 2026 10:43:19 -0600 Message-ID: <20260810164312.960721-14-floss@jetm.me> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260810164312.960721-8-floss@jetm.me> References: <20260808234016.246054-7-floss@jetm.me> <20260810164312.960721-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=1072; i=floss@jetm.me; h=from:subject; bh=WUMwcYpE3AS+4QjuhS/jgyUS/yuSPcI3ZCY9XCLDSrY=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqef+huQBuK2Ls3gZrdanYUvw6te9z2Nwbhkhd7 /GM3i3kMOWJAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCann/oQAKCRC17sMLqGd3 H/GXC/sGYrjrNkJl5ZuwOt7HEPwHEuJ8ZisqAvTfVgvAldoCklvU9eWZAnRAEEbcNUuCYKCI4qU CaYRGrjYVQ5e3eBAbHUgWx0mQ0vT4RJtOMKZm16/5YXixeKVY2+i4icM7n5d/YBwotxPkJDaktG cuMSkdU7fYr/T9j9Ea0EaKBTWaLWJ+4aayYds04qiHoGK98Prn5PiAph3J+CcP/pQUu6uegH1d6 UPAJX15BNPSgTUS82KjMIY8Q6mk1yYmE77Z7LhmRE8bH25qIAmq2J8YfXFTySAHobugKzxdkN8n Pam2Nt0RuS7zV8n7GapgStuyNbxW1636RSWjKs+38PXqfmcIn6KbJTQy0bFcGIyqQcuSn/UzntO +itSogi/bOhnrLspU+lTVcUTZ3MiaNuMAj9LLh+/m2gNWk5ZZdRpi54D4dhnE4tFeNWbI87MEuE 3dz8x/4kDwEKj/Xr9tRSVdURyDeMuL9Rg8EHvHLTrm92JOwESWkW9qyBmpilSbXG2QaJ0= X-Developer-Key: i=floss@jetm.me; a=openpgp; fpr=9B13B20BCF0EDE23454A93C9B5EEC30BA867771F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" xfs_da_grow_inode_int() subtracts the blocks it just allocated from args->total, the caller's remaining block reservation. The subtraction is unsigned, so a caller that reaches it with too small a total wraps the field instead of failing, and every allocation afterwards runs with a bogus reservation. Assert the remaining reservation still covers the step, so an under-reserved or uninitialised total trips in debug builds instead of silently wrapping. Suggested-by: Darrick J. Wong Signed-off-by: Javier Tia Reviewed-by: "Darrick J. Wong" --- fs/xfs/libxfs/xfs_da_btree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c index ad801b7bd2dd..9be407affc6e 100644 --- a/fs/xfs/libxfs/xfs_da_btree.c +++ b/fs/xfs/libxfs/xfs_da_btree.c @@ -2385,6 +2385,7 @@ xfs_da_grow_inode_int( } =20 /* account for newly allocated blocks in reserved blocks total */ + ASSERT(args->total >=3D dp->i_nblocks - nblks); args->total -=3D dp->i_nblocks - nblks; =20 out_free_map: --=20 Javier Tia