From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.175 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795900783; b=XcRsr6jsWUgB1bkU7SzrqlPFQNuyl85twre3tzhSXFV8GB3aSZqIdfwMUylU9T4BwKG7 Kb1WNGCSAT48xolcpH6ByvAeRk/t7P66noDT6sCcGwAU4/euxPp7VqfmwpVkX2wloEzlZ 7I1DnGIg2sqOfKC+WS5E2tgHRIPKTe21vuPJ49cuV21xc6UHNXFoFEtUBXUVdR/NSLgqk 81kxsYaOJ/gosz80/c0n0j4fwmTZ5F3e1wTSA1PsBugyxG8VZK79XKGZ0N/aAsZT0BABW 2717LiAupRM3eCFxMKToSlypFkCDM7URAnErkEEzo7KEI5xHElHpg4UKX34AYZmaLsQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795900783; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=iZ4TurQbEtUz8yuRBGDrsqJRNN91efg2m7aQvlF9E4s=; b=cEAUwPXTbVB6TGmFu+nznTPoL1wN14nh6Em2u/GzQeStgRedHypir4H8Dk7pRuQWgsho mgJeohLEXOb7EOkzNw48tJLqZAyAiAQhHI0BqiKIn6+fT7d660mc023zvE/sn4QSgBvbl hyFzcNQ0zAA6SmmMQSUhRn+FJlrFfIDB4q/9I5zC+VKbp5sTITM3hm8dRqVbS9aj4iiJ5 1uizgjiNPsMdwdI3ZpHL3F90wTMMCtfmKVKtYn/WteF74E2rwauphnRELDT83c+DBBRTN tJZ9mQGk2pfkDpynmN5w9O+4ygGoJpllob465odP53clJRcvj7ctvzMvDfyf3fAyH6Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=p7MKjene; arc=none smtp.remote-ip=209.85.167.175 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B27C606A32C for ; Sat, 28 Nov 2026 21:19:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1B27C606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=p7MKjene Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-4a451915d8aso6494715b6e.2 for ; Sat, 28 Nov 2026 13:19:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795900782; x=1796505582; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=iZ4TurQbEtUz8yuRBGDrsqJRNN91efg2m7aQvlF9E4s=; b=p7MKjene5qEZcQBuWvRNEVo6w06CIqZ/LMd8cWL/Wg8W9cvsshZsXSX4Jnyk0tRbMy j0Rug0gtL58ZkP2i5FYpoVzN5ezPZxCNop2gNiFdpPtCMa10ODYYM5vIDFJka7rsqW8q dDKBA62sQx9KLoXNTScX6CNEUhFcG65Nd/ZXK5OSdW1J5CDAzWWdNnzsL0mxSOZBSyxP 5UOwW0BwnpWPN2Ldoz0P9rgY05MoUiIsC3W7bagdeDUL8mdTG1vEC0eVVNX1sV9Crk2o 6H7iDe71FDp6g8uG/EXrw/64HvMxRuGiuJMgjvi83gn1Hsbw1AHsUIZYjzflT0KILYnv 6Cjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795900782; x=1796505582; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=iZ4TurQbEtUz8yuRBGDrsqJRNN91efg2m7aQvlF9E4s=; b=1B/SW0+x0w0PtBw+AZgJnioOaIwrGgdJhCa2ViS/Pq0wXfNCO9+RjjqKcDwTA7PIec o9yZowuzIb3EiKy7htrswke3HuR+tffxtD7fVpgMxsrPpCHdJAnpP6cmacBjle51EjML B4QX72l2163QxXjKLIhiQaxDKxBcMpYJTdZajt4PCdOBcyHN6/NU6K2KOQZ6WoahNCzI xiySJDzLgil/cDzhZP29P4f9hFOzlWDyWovEZN1r+X4WA0M5NlyJOeFuCPHGvFkYCktP +c4PiBYW67fybdIai3ucQsiOwZ4ysWErfeiJyuOFQAVA2EGOWEzQVNq9WVbezElDp0tx TrbA== X-Forwarded-Encrypted: i=1; AL+hErGqGdxtD46HkUtdvoPYue1k1dYAoAJVVbGTg/L9tb+CE3m3C2y3RtLCB+pQeJMxCl0xpy6K04h+OMYSQOM=@vger.kernel.org X-Gm-Message-State: APuU4Z+1t9xOv3pqt/eoLhSOwv2X671xZ+0L7tg9wUmXBu9no77eSWy/ LthrdiqIAe6RbONOEPu8Q6tStvDWLYkHdWtGG0xLEBFIReZxMOvR6ePh X-Gm-Gg: AZFdTZfQ1se5Gpr+/eblncTgr9Lby6Y/o0FCJSat/rWjS1MIxROcLYP02TquH203FS6 LMEfeFBATKhaidOfDwy3Wqc9dTrTelmSan38eNu/gwzluk0h7ACkfjjKI1r29C+YhFiHBX+Ly1P pPoxARORsR2zd5hxekyLY5WgeF74aTX2EkOLAPO8pgY9Y5sRfqxK6kM4/2BTkKSYIkRiXYJva6o 99g0ETtJ8VEDcUYPPRsRFEy1jRxpEXrv21TAAT2wQCxaKnNWUq9p+hfxpd+DLc0UPcuOjdkmnvX xLNasxPDLoAcNG5MpgrVCp7cvGMGa9aIOd8YHwH494MmKwfXIiAqCevNV3qeJEMPqT7bMHDImVX RVliticjffnvqkQzhwLrhJ9Y7xlyLdwzjkNYOWmfZkEFC0xkzET0fczCtAsQCHb5CvrLp7I6Ew+ vgiVCYYGKiLiGrVKG4IARfjyxzh8r9sLKhv/ReyUWrzetoT6Qkmumckc7bFRrRz6zBaVPiagXaR /NjY2cilSSJfe6iqyWEYbJd+u8tLu56vSsa6OAOX/7JILv9aJ/p5aZh67KriROycWG2VFkEN46N uowt5Iz/bMNRegIUOXDpmsrI2hXZD/d7zXvrGbZcav5vbiHo9XJWwHKcMCfNQbN9aMnnqQOO59f c5V6hXPLSKrTxQiIjMfjqx1q/xzDXDm6G3hmhQmC7l1VEVKE= X-Received: by 2002:a05:6808:1992:b0:573:fc:19af with SMTP id 5614622812f47-57a089106d2mr31107763b6e.14.1795900782052; Sat, 28 Nov 2026 13:19:42 -0800 (PST) Received: from Wes-PC.localdomain (108-212-132-20.lightspeed.irvnca.sbcglobal.net. [108.212.132.20]) by smtp.gmail.com with ESMTPSA id 5614622812f47-57a3485a164sm20219780b6e.10.2026.11.28.13.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Nov 2026 13:19:41 -0800 (PST) From: Wesley Atwell To: Jan Kara Cc: linux-ext4@vger.kernel.org, Wesley Atwell , linux-kernel@vger.kernel.org Subject: [PATCH] ext2: report failed synchronous inode writes during truncate Date: Sat, 28 Nov 2026 14:19:22 -0700 Message-ID: X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit For a file marked synchronous with chattr +S, ext2_setsize() writes the changed inode metadata before returning from truncate. It currently ignores the result of sync_inode_metadata(). If the inode-table write fails, a caller can receive success even though the new size was not persisted. On an unmodified kernel from the ext2 for_next tree, a QEMU guest used GNU truncate to clear an 8 KiB ext2 file marked +S. A targeted write error on that file's inode-table block was reported by ext2, but ftruncate() returned 0. After an abrupt guest stop and a fault-free read-only mount, the original file and its hash remained. Two separate fault runs reproduced this result; the healthy control truncated the file durably. Return the synchronous metadata-write result through ext2_setsize() and its existing ext2_setattr() caller. With the same fault, GNU truncate now receives EIO in two runs; the healthy control still succeeds. This reports failed persistence to userspace. It does not roll back changes already made in memory or repair the filesystem after a device error. OpenAI Codex identified the ignored write result, drafted the fix and changelog, and prepared the QEMU truncate tests. Both fault runs on the changed kernel returned EIO. The healthy controls persisted the new file size on both kernels. Signed-off-by: Wesley Atwell --- fs/ext2/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 1989258aef8a..43d155bb09b6 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -1266,9 +1266,9 @@ static int ext2_setsize(struct inode *inode, loff_t newsize) inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); mark_inode_dirty(inode); if (inode_needs_sync(inode)) - sync_inode_metadata(inode, 1); + error = sync_inode_metadata(inode, 1); - return 0; + return error; } static struct ext2_inode *ext2_get_inode(struct super_block *sb, ino_t ino, base-commit: cc226183b2c07b301f21af709b2f95c8c7050393