From nobody Tue Sep 29 07:39:17 2026 Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com [209.85.221.170]) (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 137A63B71A6 for ; Mon, 10 Aug 2026 23:06:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403180; cv=none; b=iVAx/yYEjCXidbPlNcst/Tn//K/U+PZLEpPXSuGS6M6sOlq1Z25DLYa97e6DfDWMUH2KJwYuCqIujmzUUB1vj8RT5n4e9XAuAByxItupLLAXBJu759OLUrXiJqGdc7hXmXKxQgazkqJBcJ5LdtDIoIiDfmyX+GiJbEAh03maLbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403180; c=relaxed/simple; bh=O7lAK9Itxu3BtFZebuGm+soxk8EufQFIVRqNLSr9Y0g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DYCOHTtTklA2OPJIFGtpUX2mgTAUaAgp/0gOlNUzhtNazBJc1ZhJfSnaiYj2FrLCgUFqEtXoC6LTDnarK6PYT0eUQ3w2YLk9yCcK5FZs6qcOT9TPoNrCPRPidjECKmQVxah4fAlklr3jEKOPBZJHbvf3HsAVkJygQ0o6TQw/zmI= 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=dcfmmgL/; arc=none smtp.client-ip=209.85.221.170 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="dcfmmgL/" Received: by mail-vk1-f170.google.com with SMTP id 71dfb90a1353d-5bfc4f26c67so87882e0c.3 for ; Mon, 10 Aug 2026 16:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786403178; x=1787007978; 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=dcfmmgL/UcF4bmjkp9fEgXkxf7S9WCRAv+4lyIa6RfeGT/7FbY8X9Her51KN1GZS0o PW3c551S6yu9FfxpEzKDf2xEgM8cWHqHXK4wQhl0UGkY9ACczYyTSbAgS+FKYCinRdU6 45nfGmo9umsCx9kgDBR3f1PBs1iIJoAxU97kuQggBj75p9mnBSuQ+Jc3TSv2YYoX6yra TK3FO6pVkCwLMMC9PBQmINTmqWPyfwjpRALxx1fHbLKNLTbFiWuMBvy678ZRhPxIxjGP R+MO6fSm8jSkojijm8vo5/yWulLUGpwKVZaPX/VPwRLcCO8RyBSkR5Dm0bsjust0+gWQ 1KkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786403178; x=1787007978; 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=E1j6wC0btmqRKb156Yu2fEpqOAfBfAUVdCTfektgEmDtJigcuqQtQSMwXZFfzM7XdP dyxhE3u88+A5Qhs7it4Gqsk33lUbLj309SVujG6tGrPhK6j/u7Ss0q2vijlxJH6TLAbe dG5oYV/07/5IvT9Ys9EEIsi6WTHVBVvDx4EYwqCex3SB3CIrOFEs3gxnQkodQ2Z69n97 y7BsVAaEP3q5il54DiMN0ZA/r8qONNpVocdMZ5kgsqzUfc5WSyrG6mCc+wgAq1HCh+ot yJkgcF8JG0MVShdbAo1KLqsUXXBakpKJGGUdqTmZV4L0qNFUO8nFICD3W/tEQa/cFxUf YELQ== X-Forwarded-Encrypted: i=1; AHgh+RphY0M/xcrmwuiMEk3blUlgMKrQk+9bENo9U+e/MRclIYYijU+hjOk8c1TSvLhLM6RSUHiiVH+cAuvzj4A=@vger.kernel.org X-Gm-Message-State: AOJu0YwND2yyWyy30iKPMEom2447j0Lfg9AmxfYTFng/oOoiwcwlsjlS vP5JhHa3XyIJC8z4GkrwOwYSz0j+r97gB4ehVJXZoYUzdqDNTr85quFHKdWFdl1CUJ5V1665gEk ZduWVNUs= X-Gm-Gg: AR+sD10kRw71oUw31no6q2lrhfeQuTfPVN6fH/quBKQehXMvnGTOm3ocO17OCZCUpRt ugP3vqk0cdUpZybswVk/sF53ToErbsBk3NdMT+T5q1uGOPN01fXnM5gXq2dTFwVt1OkrO+nfoPo 9+0ihp9gl4cfwU+8FBdPiC/mY1QJ/DpGh3e+XLkvyxIqnObwjXcAWMfpm21+TAypH0VtM5Ocmfn GmTlq9u+y3X2+TT3IemeB3Pq1cMUe1itsFdXGynhk/rqNIruNGoL/5hOA+TalBcwo9c7jGRrqs4 KGRcMKWS4ju9JBOFxgW8F8WWvGHCKFGHWNuXPAGw4vMNdzTVYlNo46fJ5MUqv0AiEDPJpOVORou NvXa0KRH3h+EwHg3QSvDO7YnmFwG0YZPFCsZaGj/0mPY+yHHZ4Btc1OXgP0f6zDvcTqD6P2OQjU KGcQHHHusA8RMCui5+2qeA26n1k1ADDMpMXcVSa0MiNOhJYCH+FGAbz9I8s5kqkI/ozA== X-Received: by 2002:a05:6122:6c06:b0:5bd:a3d0:923c with SMTP id 71dfb90a1353d-5c3d8d1a62dmr4758463e0c.0.1786403177877; Mon, 10 Aug 2026 16:06:17 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c40b1a8f75sm4737386e0c.10.2026.08.10.16.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 16:06:17 -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 v3 1/6] xfs: initialise error in xfs_defer_finish_one() Date: Mon, 10 Aug 2026 17:06:13 -0600 Message-ID: <20260810230611.2859909-9-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=1468; i=floss@jetm.me; h=from:subject; bh=O7lAK9Itxu3BtFZebuGm+soxk8EufQFIVRqNLSr9Y0g=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqelljdkIzN6Vm6qJyjzD8yEylWzJ49lYuL+7hF mhBN6Hvjd+JAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCanpZYwAKCRC17sMLqGd3 H0h2C/9q1FfvCHZUTjpMqZgcixlBy6ktrW3R+ilbZX6SIJkKPmGNb0tgsfoS482naCCHoSppic0 uTZLgE4fjZZ6d4ScY4ADsthGb/BtRLZddGfZfeKjyV4o0bbcPuJR1OsMI88X4Z8iwOwGT8RSXTc ku9S3RuuqFjXuHk2y6OZCTHgVyYvERsHRr3CXYwBfMs2lWqkrGy3B4R0AFi5gJjwKZDaBDsgp3i ZUacCCJ/plSySYNri0ysQvG/PoeJtipZtQ5j+u2A2bj/99QYh8bjM/4bIjzXxlQ4Wtbna6q+0x9 Gmjne4hson+QfKQfrtNy2unywyTyAl8XZJ4GfyXmj+8HBVD+rbRoS9OZvow8y6ChHSjG265UWgi AIQglW4YZECI6+gc662fccIAmFwtMphfJHb1yehOgXrl8bihT/OfDs0mwIVvJByQQbjjWu7KZUp eRw/RUaqOTMmP82N6K7Z7nLmFGtTubaI4Ak2SNm1aT1df+BWtx5PX1IWC842WD2bwdj8A= 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 07:39:17 2026 Received: from mail-vk1-f171.google.com (mail-vk1-f171.google.com [209.85.221.171]) (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 158EE3B9DB3 for ; Mon, 10 Aug 2026 23:06:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403182; cv=none; b=IR/owW7zEcDL1mBmaoh88Yo/z1aQ3JydlO7wZR/ZpsgQ/qDEpGiMtNZ6NOokssMGG5gXkQtZnGfwS3t7mrVcPtqyf4is8PJ8Z2wripm+Mu/p61FCy0M30OWq9lSB3R4yyCEwGJiqBUtdIH5OOtb4653IywEq0JK4YS+qK0JWS6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403182; c=relaxed/simple; bh=cN3dntYSRKkBZpxQVRebrXb/QZ7i856/vDVWzWsugXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rUyx0/ZNzvJ+NWESIRH5XvY1xDvCOfwT21rullltbTrH+JX7zMKZWmkEzS5mhevth2pl1fLLuj/ts6lP0g16v2ZDqq923g6sBmzr8HAALqEo2ib/or6si9hzyP5g2uca2dGCEPmacwd0mkbSQ1a3HAt1nGwFoJ8RgNLKhgVcrMk= 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=zgTLPEIy; arc=none smtp.client-ip=209.85.221.171 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="zgTLPEIy" Received: by mail-vk1-f171.google.com with SMTP id 71dfb90a1353d-5bfa60aa6caso62550e0c.2 for ; Mon, 10 Aug 2026 16:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786403180; x=1787007980; 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=zgTLPEIyDyNu03GghCP+oVAaanG4lX4gWWNonwSreaw6IUbyXQ/6jAj/0VruyPuFuQ mN9YNSxlSBSd1aG30b8B744F3hfbjwDyrECr5br5dQys+vScw5/+KuOzLola9tewQuBy gFux9/mfLs3rUshN4vcpceBDR1j45kirwBTnlXWmJUfgZEpUAh1n8TdXHmLYYDyaSsj9 grQU1S6quBNtuqQYizjYSItidQXnCZbRx1vamqVR/QsObnL5CTSixUG+PwSgH2OTtden rKtHVaTGTWT8BXvDi4SBQE0Aqyg9qAWohOT01mcOKd+3iIzkP6j+ulG95EY/1LPVy9XF +vKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786403180; x=1787007980; 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=H3H0UtOizZRoyzRp+t0+IjK0MMP6+pgzafeBbzgNu3k9ZSYQc/d9QRkh0I7+QvYe/+ p+0/EN4Omw5OHfsfwfQCL0zEsXAwNRVIZefQfIkSjctWQFg/SnHf7leM6menIFV8Tzz2 VZo7w+T4FuFHrLdttu7yn41TP6P7gfnPQzVOpQXCT4CrQaRAFD235IE0Q+dt1m6u3QTV X4LJgx/a3ca6RavUtXeP945n1h7wdZEuwiuflSWTQ3oObbEqtGU7DxM0VlNMMRaw03dc SNgb4RVAc6YrHzoOSQcnAwgNrb2uYezL4FoxZkyDL7fPTeUYo6bg8xSVUog5O95Q+GLH 8KbQ== X-Forwarded-Encrypted: i=1; AHgh+Rok1Foy3DHdU4uvLqBRB/OBmkPfsKv2FBO6ZanQyKyaGHGC0BU7FAbnf+XSfXwgXuh7buPuDpjnMidruzM=@vger.kernel.org X-Gm-Message-State: AOJu0YxCIdSOfTClVt+JKuZ7af3yCZUI/+Y7zq1UAr017i/XGrFclbKV 6qfAxXo7bU52VnNHKlatVf1LI3FWStjL5nnplx6HZf4Ud3FgpVivlh2o514kVmI821dsEmRHtTg hp5GSrX0= X-Gm-Gg: AR+sD11YGlOE1dEc5/L+WyUXCud9+K0IhMdNXdaZOnW9f12TSzH2t9HaLQbtnKrgKhF hIJj43iPmCT29T7tqvZa5ZeHNGKx/CxO+Vi71YJxEcJ4v5LKQUtmXElT3TBp/boveZ73vKvczA6 0631xnI/hKc6gVhHaJouVljygprJ3PJT0a1gOyRBuDBERfKNcKk1YwNhrg5anGGId4Mpud5Ghar QUwi89JjFR7P/64DkOEVsZ1JN6A8g2KoLc29ereBSpHIcbZN5DtjP7KdpqDgQrKjnC3TnUwaAXq ZikrN/PvIAmbiOFGgMsjWOyboygdh2X2GdYtrwbAYPgFPweomhcFVErasTXm9msjWTc9SaiIWvB iKKhc4yztIr/ho2jT1xTIEIuiADrLiJj4DC4RFJF6waiTS5U5FX8t4HaEYp0ZSWvOE22Dc6Ri6k PmLGjMn5diPjQKX3F/BzpzMf7oDBNhOwLbyrXWGrbNHINdBANgbJ4g7d5mWFXHI9DqP9xA3xif0 GKBmtajmBLzJXc= X-Received: by 2002:a05:6122:6b8d:10b0:5c3:6e8a:4a22 with SMTP id 71dfb90a1353d-5c3d940b089mr3357590e0c.3.1786403179879; Mon, 10 Aug 2026 16:06:19 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c420a2d1d8sm3340875e0c.6.2026.08.10.16.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 16:06:19 -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 2/6] xfs: give the deferred barrier op type a name Date: Mon, 10 Aug 2026 17:06:14 -0600 Message-ID: <20260810230611.2859909-10-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=1371; i=floss@jetm.me; h=from:subject; bh=cN3dntYSRKkBZpxQVRebrXb/QZ7i856/vDVWzWsugXQ=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqelljZqnJOJa7RnkDd+smQ6u6sTV39cbOgg3pl R42h1J2EW+JAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCanpZYwAKCRC17sMLqGd3 HwjgC/9W+RZggkTvAas8vSgCzWt+sCY/+LWSwn8Zb63ECol+aJvCAiPZRr2cOROR+wuB+Oc6Hq+ fX7Ku1B4/T9TIPW4ClO5az8YG31sz23EgwCDSEt5DCagmasNmF9N0OWRZA0BJz+RFfxFtuAU+Ln 7gNV54+UuYYCbSrYBZPlUawEJzZxIqctSqKZvAU06FfJ0sNQs9Qz8Fgj5bAJf+vOFocrgkTlGMR CXBpTXLLvzR/xp0PlzyriXzO0AMcmf4i7CRM0nxFoZ5DTzQ93+/pSTu2lfcOB07p3bN99s556b4 /pWImMOIck8AYgKa10wxkRe9ZhiZSHt8KD8k1RsoFu969z6PONSTSwIpOLMBJVMeBqj4iRnt+V7 czDk5j4n5ld4UWZqYs51fSEYShsMtoimfnKUsl89mYWWB/QZ7fH1VgzX/F13Xg4eNhVz1elL7e3 7kr7G9JC7sVywFxWmCmyMM91RzR/q6P4jT7Vhv1jkUB/muX5Y2Q08b4mfrgdiaohHLvSs= 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 07:39:17 2026 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: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: "Darrick J. Wong" --- 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 =3D NULL; + const char *what =3D "chain"; 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 "chain"; } =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, + "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; --=20 Javier Tia From nobody Tue Sep 29 07:39:17 2026 Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) (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 9C56B3B71AA for ; Mon, 10 Aug 2026 23:06:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403187; cv=none; b=rTh71BUB9xRqK3MQJkCaWhB3D4zTwzVRufu8JVK1KO2dnWD6xaAferAZ0wSraiX4pxj1YYeR+gee1957tqcXj3AzUq4FR+dWX0JRhy9mKM2RsTe6w1qdqj3UTEYfqQXkkFVb2fLIDLxpd+OOQLNtmf1XC8l+nT4DnA+AiMzM83I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403187; c=relaxed/simple; bh=NNh5aG4w7LlGxuf1r7SXWUFUWOyJJe//FeT84ioNlzE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nfo14WAxN6+atBp+bEUCRpzn2JpgWoJEVQ53O1CWtWcZVut6Ad/k/o0PNWuIRTqUfRgNKG9jKi0eEyRq64x+m86bF6Z47nSBHslCn0N1a/3IFGoHMUzUoio/6ZVpKnWPO4MyUqu54K/YTapPL40MIpFMHnuKgSLefR8JE+sWZfY= 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=WczM8kNJ; arc=none smtp.client-ip=209.85.221.175 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="WczM8kNJ" Received: by mail-vk1-f175.google.com with SMTP id 71dfb90a1353d-5c2e66ecbc1so54678e0c.1 for ; Mon, 10 Aug 2026 16:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786403184; x=1787007984; 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=WczM8kNJommtabL/wvftUnWCFHJYqdkoSHfQkJ53EB84A274xoSPwfWOiN7iOqK9HR HICogaug0QhRwGhxMR60Z78I5zjvTT0CSQ2884mh/zzOU+u0U4ToUQqBeYDU+0Zg6jVp jekAuK416EOzeWwvU9w+oX97A3esR82rRukrnmWvWeDUHl+IW7ulD4Ro2plXSkkq4lVE eFlJj2aGxhXQO3saXDk3v3h+u3xrjwYAd7szbc4lde3ofj6P33ePPTe1LvYMpVEd9zHW LQRQ3v+yHIhOoeIPnH1eYn3tGfQw+GGTwg5q0TAj7tcWIVytDJY1p7T9L4JMSeGMF8FV r+0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786403184; x=1787007984; 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=sBw9+GY74T0P9ExaSx2TCLJuh31rJWoIvqcaHUsZQll5iC73CfCqCxXlXYbq2V9Old 8gToakm29rLT4r4a6FIzeIOO6QnNqxsKmeBfDLmMzuWeZgpUCQ/eezJy0gBPNfnI8D6R av4WCXKUo8b9CO15XJg4uugcgnQIACVYRKxEAlME4Eu6JbB435HoVYd6sKqGrT0FQ72B bzqC8FtDu8wM04BL9VT6f6SZPSBdEEjJcYW53dUgvX2q2EdZ439I0+zYczrjDTpaX1xK /z7A03LfFHRIktOD2V/zDvLry09ceklZvVJSLiSf+TQoDOjG8mZyjRWlanwk9J6ChGvV d1zw== X-Forwarded-Encrypted: i=1; AHgh+RrmQ/83erISYsqzoneAcyWRgjgFvp94I6wOu/9HfODWtPd0UTMJ76+6SjQtWvaJY7HEmjW2d5j4swQ0uOA=@vger.kernel.org X-Gm-Message-State: AOJu0YwiZDwQyPMLyurfCDl1r67BzV/DxrE0N+431xjyvJ7pKbi4RSG2 ultM6sZFEHqW94uJcHTWuxTETe/lnBwhskfh5kium7Kkq3/eE7WxvAp/CeDfP8ldJEU= X-Gm-Gg: AR+sD11BEubBxZc6IYE/380XSbEG5Dw43fSMwUJLZFD7Rt2BOPMLDgAT3iUh8IBKd3y jnAm4VAb35HPfQGqxZ5N3iO8efVqc1eqLWwK7JIzgtQE5sYWtwI3uztb43vhhJManaqM0hz7ddG xfRDac66boeJZkC3xlcJgey2JM7tF0u1umIQ3UKx2iISGw1Og9LXLhs5OtgjzN3Bt0dm8vOVWOs nA+Dfg0bP5rEy8uCC/mO1DJfupnV1dsLqMIpby1INaWLnThGnffcd2jYk4ttWlZTmkzzuf5wXuw f5WJvGy3uF6nE8eR5b/4O9il4G/CsNsHrZRxJ61tCXeYtWjpF/xt+5ejdUnRi2nUCha7c9md5qq yTq2ouNwwxyBD1207YEoSb83ct78wWJ9G9LryFZmVXSHDjY2OLcozSk+yR9RaAIrsa1vdl0LGug zxFXmCl02mCtLHa3SFB3PLSI4JHjzPSt3+RaaGjXpzz1IO73+7TtsXt4Lhm6maugn1aCorSkxBs 1boB8o7TpZoSeA= X-Received: by 2002:a05:6122:811b:10b0:5bd:7446:e3ff with SMTP id 71dfb90a1353d-5c3d8d2a974mr3435285e0c.0.1786403184503; Mon, 10 Aug 2026 16:06:24 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c4130b358csm4079079e0c.14.2026.08.10.16.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 16:06:24 -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 4/6] xfs: correct the parent pointer space reservation comment Date: Mon, 10 Aug 2026 17:06:16 -0600 Message-ID: <20260810230611.2859909-12-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=2488; i=floss@jetm.me; h=from:subject; bh=NNh5aG4w7LlGxuf1r7SXWUFUWOyJJe//FeT84ioNlzE=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqelljTRG87aijZKn3RyqSuNdDpFcbWIcNNA3Fv LL1n2VxtmaJAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCanpZYwAKCRC17sMLqGd3 H97tDACNSkjSduKs7yBuGaO3TXyJA4JaR52PXs/TIUBjGAZfwm52F+FF8XJyZi4LHmlmVX/UXPq LiCiqQ/NYQ83y3zySj5iL0TYzIqJDUhBTGreX5eOIr+ORJF4tt+jtG8WsHuamds0yH0N2keUidf qfkLlPlAOk8FG3k1SBLiyRJ4DxFwP+IrKxtmFWVk4aX1yJ1ehjDjwvCFXpfJsAB6lD0idmfhtQE S0b5W2YDd5LCRbOLTufCUTEiOGVVqhdJSzsHdrpGBpndbxqutS2yzMoaN8n3frzqVs6J4dpgodb cIANkFdLugS2hY/xAVgWX/1OhTg+wFB2pa2PP+MzTKtZ1bs89+28HQNeOz7uv3Y2oYYDDsOT55T /7hFnweiBvYTZ47CScUQnzRgUyuEhHHq7eymAsHQvHXAqs1D5Cu2sggPpHHnJe4/Zum+vbJBN9q R0XbuTfcNO8Sitb1fYq0uBpIdeRX4/tpYCmaunqSy1mW7T1VadPpWUYqmUU2ykqBuNmOY= 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 07:39:17 2026 Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) (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 1C4103B7744 for ; Mon, 10 Aug 2026 23:06:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403191; cv=none; b=JhjMEE0m+pqzc3KcAQRVMF2BINN9vWeXR0VkJJ0422gFxAD1NER23XuJYlIE03i5T6yLP4CpolN8knrg7nu2Vo8Dm2SFkW003VhuVgmjG1i/qkeEnqsScBjVA8k+8DbiD3BT7y60RClnqrlzKaHWB0EPGvWxgM38WCAmlxwzvYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403191; c=relaxed/simple; bh=IzuppipK1dEFr99+pMsDknXhyhKbvUSEG1CYeDnWIwY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hnWgzc6UNNEqLGAYA5FiOzKg31KtU8tNvtrQDmXprNDiv/vSiSO1BgZBBzRsWkidcA6oLvuKR6dmb9KA9ozHgfMB4Is4Y3DBxdFZkinEKOLP/aMWvkhToOrKEdftl1lDUNeNUIqMCArwp8EsqjYbEB5x1M1H1hoQJeTCzHWxv/E= 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=vP5BD8uS; arc=none smtp.client-ip=209.85.217.43 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="vP5BD8uS" Received: by mail-vs1-f43.google.com with SMTP id ada2fe7eead31-73a334d1128so64475137.1 for ; Mon, 10 Aug 2026 16:06:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786403186; x=1787007986; 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=uSGSDxy2zUMBEFhOX3vJ37AYVV3JHVveLhDFnDI+8Zg=; b=vP5BD8uS6qVjAvKCrioVvJjghzs6fYvP57ZscTusOP/oT3fFxhhXmKQ+Zuy/jYIdxg ytosKp5VLWuMCZe6p9Xh/ZVE9MIZmuoCZceJXwVPLl3ixy+VkwJVZd7y3Bs/oMiGjA4T IUGHhCQYrtri+5yiyzwgXvGY+HIvAX0nS1WVMiKrEwu556jtkLUwuv66GJDH0E8POwb1 YE4q2uX8PJF61smdTiLOmuiYf8pIz3pYhY4jsgyEJGLZgLHmuv8jlnEFAosyUcdsTFEU FexCBporiqGTga5/5n6skp5k14P8k3CO8+u0VwL13WtSYVLcFnR5eiLFcw5Qss2qHPeF uFdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786403186; x=1787007986; 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=uSGSDxy2zUMBEFhOX3vJ37AYVV3JHVveLhDFnDI+8Zg=; b=nLpd/WcDKcX4I4bbvAJGQQgJa5Z3aIXeV3KVJ3I7kZdOdytERXkBopdhKYSsuTF05O yz7Q7Qcl1YOyzS8zcgaT4gs2RCNPOuaASKPtreYwhFxUE6aBAZp31QbQ9pVJ7lqNOvp9 74hihvF1TEtA3gGO1HH6hjULRkJignFxQK8vVqiIgnoCxcnwSYFxFfnkPZhza/Lcmotu YrXOMb1UDSGez/HahyLzP8xvlzepw3Ti4KULa594gytZC2X3BzPQJPT0xn6QWDHTc6O1 VQ6MSGzAzZCFChzCOchfxdsiAqeDRwHncFHl+DoMOQNZdZINDUY7XxlFyvZyj/jUGvu3 5kCQ== X-Forwarded-Encrypted: i=1; AHgh+Rq7uqfI/ZDSbPtbckfaDfNWHvHlhLezW3vHFzOVprM1LEVvD3zUrOtgPJVQmnVDnvwx+WNpz+YYLTtFxlk=@vger.kernel.org X-Gm-Message-State: AOJu0YwxP3raNuSXByh04LI4BLDlirjeQxV9+M1e3250EHmHet1QNvfO W6YcupxsIJvIgR3rmmV8d9Ma3yV8woeyUS6vjv7T8k4ZPeBQ4MdNbf/tmvC8mJadBTU= X-Gm-Gg: AR+sD13S3Wbv4xseHyHvVME3GKnRokYaac3KIf04K5hcUKEo4JCHU0ZNoRSakM5Wfdy 9CPWRF0gczkYJk+e/ykAuztm9tsHW2upaoNcg7UogrdPM5RZO3x0jQbDdKwcJF7KPmP6SW4J4QX HWP8HJLe52C6r2UTU9Et7b57WE/otIngD0iik43a6PQMTESbgO9Ze4mtvqi76y1Jaqe/MY/B9/j hHXrqHQI+dC5D7PJqWTA51gNkM4hf0R23/9CvvU6DKsepxtFT2hd4VJmhE8640+O+Z2I5FyMWH8 tPIySOUFvkMigfueNREBeo6oo71/0FPsIZbWwlJYjpXoL577hI7zYwSHUN4nXRbe/QwiAsLkXjz obo/J2R3J7Opnu2Pa1nBxnhea7wXWlfhJ4Yh+rtriiyvK8mCYBtq1BmTiU5/GohDnJRNFSaHSaN pRhJCU3Mj3l6b/2kf3A/Ul7Lag8fU/Jcs2ToePZUdXz0GnOjf0MCOBy2s= X-Received: by 2002:a05:6102:3e84:b0:74c:551:54d2 with SMTP id ada2fe7eead31-760eb45605dmr6973438137.4.1786403185824; Mon, 10 Aug 2026 16:06:25 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-76400dfe036sm5284342137.8.2026.08.10.16.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 16:06: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, stable@vger.kernel.org Subject: [PATCH v3 5/6] xfs: initialise args->total for parent pointer updates Date: Mon, 10 Aug 2026 17:06:17 -0600 Message-ID: <20260810230611.2859909-13-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=2528; i=floss@jetm.me; h=from:subject; bh=IzuppipK1dEFr99+pMsDknXhyhKbvUSEG1CYeDnWIwY=; b=kA0DAAoBte7DC6hndx8ByyZiAGp6WWOjlAjLdfWNwJr5dSRkdWEVI7PiFkDsDAdhGLXRGXpTc IkBswQAAQoAHRYhBJsTsgvPDt4jRUqTybXuwwuoZ3cfBQJqelljAAoJELXuwwuoZ3cfko8L/R3Z o++3z2kqlMstgJp+Ec++0Y7iqhb1w2c9ZmdbKVWnZ9D9kWzHFj2m2F8hEbKPq8eT5NfqHC5NYhf EFA4aTZKN+Tq6I/yr9cba3d6AMxCAIv8fVUuPsRxYBx4AIN2hPOccIX02rGCkGHz/GrdZ3RVJkD D7FGjoGSNqiPApdMJ7wXoaZAS4fFi97zLcECIPIklvwzODqEN9fSlz7j7FvjH7eeYkxw0hw47FI sjX86gS7nAeC0Y7MyGgU6CRu9g3E3a90TMq2sdO4r7nzKdVlAxE4rTW9RJUz7D8x2XFo2WmuCB3 qli9e0sGKDkCnCzRHaS9Q7OoQLdSFbOLSdGMUw2zsOlfXyoPYZbRvFU2vLdFbJO17+p9T2yCIa3 gq3Ufr67312unu33K+qau5EvClnyxTGgNtmLUoJKzqf30b4bbZJpAla/OBVhxm4XrsYPLO0dPUk eOjqgLMXbkI1SCadeEbL22MtYRJ2bbN96iesG8iOvgRwBuBM0YbJ4yYY91iw== 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 07:39:17 2026 Received: from mail-vk1-f173.google.com (mail-vk1-f173.google.com [209.85.221.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 003AE3DA5AF for ; Mon, 10 Aug 2026 23:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403199; cv=none; b=tXKw8RuNcO3L0iLCAPVtCeOIcG+R54tr0ECzI97dEeljGF71Rv8ozeN0/rTVBqVFN7+AOA+Fe43ZJGGViMYlkLgORql99/ddDREb4AuX09E+MLoMVBjnUsXj9oROumiIbg8rylwRR+PeNFvk5v5P3K3+8LQELAFg/dqrg715N9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786403199; c=relaxed/simple; bh=ew41Ui+Mtu2XnI7H4myAGu1irg8mIu7VyIpeibPsk80=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h+CkLpHg06eBXm6KGx6vYrBdoi8zE45bFCa86ViN02D4UmwVAVb7qVtA8nt7mHoGLmEt/yvi4Q8Be2+WfBDSOxyEbB7IV+wNmJBh0zuwzeY3longnHDf3EDdCFrWlsRIk9NaN1quYR4f7lW70VmoiFpb3cCcftjVtmpEucbgMSw= 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=sfkP9O6l; arc=none smtp.client-ip=209.85.221.173 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="sfkP9O6l" Received: by mail-vk1-f173.google.com with SMTP id 71dfb90a1353d-5c2b6d3f2f6so94177e0c.0 for ; Mon, 10 Aug 2026 16:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peridio.com; s=google; t=1786403188; x=1787007988; 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=0usgXpPODhk9hKOhk5YF9ap8MJxRZDFzD06C8UqMFw4=; b=sfkP9O6lLFSZnE4vCGuLS4uStO2b//FYDV0zuYfKFDXfSH2aORr2nqKNsS0cuuvChp tTEdU4dK9wKrgd1YcDhMVNEgMHKELpPc94KgVKiNsEd6RgDNVJvoiJEhxuxJVIpfzTUF PJoahhJk4eKA+Txei4UzCDsWItFYUmm2KTfgLbE3Wwy6QdGK667kqB537h2IQdogOZmO Yi5sCNG2AdcmugBjrmhVsKa79PJNz58icppFbfl34wXznfTgIdNrFv2RGHccqr0Zw0wp h0DMLCoyhHvFhYrCxh/v6nx01RgMsOYIisFpOHKh42Nb2CkdK0CryDYeOF/X2sDKZEOu QtZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786403188; x=1787007988; 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=0usgXpPODhk9hKOhk5YF9ap8MJxRZDFzD06C8UqMFw4=; b=P2YAyGvZUe4wIBMtaXcGdxQCCp+voAolZXdwRrwWba6oqJ7v5YZ7YMuWw4fM+9uzn2 RFpjewnFdG4T6wDZjDN2nTLxxiiyvUA1YP47IhfPoWVW4WoRaIksiAIO7FSqRRXQvsUy A3p+A+NlzJqosXepDnVrNXJNV77WtLzBneXVDlzZjKDyT1Bx6srAVAvimsRIQfWNYrvG 22CJcRNnFHD+KwCbvptcp+BS4VhF9exzAKixA2kCEo9Mm0RTgS4T+nsGX2ovLVtQW2zC M0jckJ8gAgSfu3a7OOmfYYuRRwNrV+RpH9s5yy5uZ7ZcwZudwfjQ3CCzCFpOPBPE0rmQ 6LKQ== X-Forwarded-Encrypted: i=1; AHgh+RprmGMHxe5n3s2CUgrghOouTonnOylTaYdjsPIGpo785EWHZRuaT+H1cSonQJ+DaT9bAInoPHmhbQIJPkY=@vger.kernel.org X-Gm-Message-State: AOJu0YzwMa2+fvHM5QSY0AEVMPZnS7aYVDoQJO1LW/qsSszmPaEbv5b8 9KmTt2JNConW8uKJ+GACKfNNiJCwmRW4EUCmvcFtxjK8p9GzFYuOsTYhrgn3/pnn2pk= X-Gm-Gg: AR+sD10c5jP45Xr72iyPr2ZwR22Qh2iK+t6rJaiZbNd8hmL8skS5WZVJE6d8n4g2vPJ 1wquiRHyAGB7Yy4ts57Gx8lHZwMZCnbW12V2/jTHsg1MT2E7koMZffy94C0+WumQdQzHZuXV1N6 uaYvT9j2bj1XFpS1vZXs9dPhbMtWsuEaqdW5IF8K+QClSbI/E1cZS+/YRrQekfg/wT45/Z5SkAI Bl7AVI9MysJvoSTHP/N8n4NOuQcXXuFJXasByEjAkgnXulzqIwsLUWI9yBFZ2zQCBO8772VBlyT QHmAcYOzYTMr3FDp8JzsBukWsB+TS40vo1w5LAz5dFDlEgSgRwFkPtYep++Z1Y4ha5UCwblDpU/ MT2Aoc8BWftnhHD7vcp7Z4pWPnW4HizdkbefNLEYSyqJbXJgez8wkPhAfRRudyzMWOJlsJOONU2 CQKWXuaTJKAZMuJ/zbHqtjALEF1Dzh4X7iRhjgcskwyZt0mr9rlfe5S/BiL3YO2voj X-Received: by 2002:a05:6102:3ed6:b0:738:9abd:9ebc with SMTP id ada2fe7eead31-760e79e969amr6666021137.0.1786403187350; Mon, 10 Aug 2026 16:06:27 -0700 (PDT) Received: from localhost ([190.113.101.40]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-764013f3489sm5458692137.12.2026.08.10.16.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 16:06:27 -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 6/6] xfs: assert the reservation covers each da fork growth Date: Mon, 10 Aug 2026 17:06:18 -0600 Message-ID: <20260810230611.2859909-14-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=1124; i=floss@jetm.me; h=from:subject; bh=ew41Ui+Mtu2XnI7H4myAGu1irg8mIu7VyIpeibPsk80=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBqelljtjemURn5LRpl6Wz+JZJUD6qD/0CqLlJto HUOpnbw1W+JAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCanpZYwAKCRC17sMLqGd3 HzrZC/91IQKPbjMT3p8vIklGy/xQ9Lior9axlrMh3lEthy5Zpwiz/hCOKjP77kZyxs1zfZvwDW/ QnTfns3MnXxv4cmZLEC0gxgsAd6K9gsLXk7L65XuVWJRP4Z4AdlzhFHH8oJjrMP+3G6nJK4vQ6k XtsJkN0AUHVuHVlgV3ze4erwUUCnjiT3Y3nli4U0KeuNE+ZubSx2kASv0br6X73MmvicSpubuTb qm6sBFmpmULN1PyYIjD8Ov/FNipxbgL0OhGigtlKUOKFaHH1Kv6K4mpQN3vL4pU3Kb2Gx+Q/8lb aKMID4915/N+dni9RIswOcT/E9XZgbKQAa9CibLrap6OR77zZr6ar3qAJlTM9hOCsSg0VSQ1zwa Q56AxfCBd8lR+0EOAAFc/FCeTejqx+sj0E2BGicHHzS08ua1T5oNSG3pZmC6Yc+Hpbyq9qz52zT UJvZPyt50o7olsvORStgAFX9wQ2NLHir6QerC4y6hHBVROutdCzHJ4tcB1ewMTpSRsATg= 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