From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.176 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795900783; b=G8nz5CdOPSRcY0X+mQO/EcS0dhYR52S8H/wtGfmVezW4osQfTMbNrjWIzFTZhyfP1R0e WOrQCMuQKPyMF2tWF/CccvFmjjyi95uYphLyP/A4jK9hSZvWBKWMBheQ5f3DH/yi5Z5up drFSpY3sqAwKHWoAdTasz5nTZ6rTJ0AmOn1Zeir5XWyVE0UkkMYlQ301KEeuXhnZwOKO3 Ew1CcTLMpTNwj4oPVpQvc06jdMoOiQfcuJdTOm19jycMX5TDLc6GKjEptSWRkZjkGLNO9 rGl9WMsOwuwUZtnOUQbB9aDfKpd7DS3iPMu6wh8h+E8Yoz9IzyAG4Eb/EBD1rX/MzKQ== 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-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=Rs5e+R/whfIcdVzQb/l6HXCP8oiFO91D3k/c8n0umtVeXmh7N1Hgtv6iy6UbaegGRMQq qpyRoeg0BeiwsUz4eQliAydd6n1jaMJCtDa2zCe5TV7YZi+0dzSLkfa+aMZ4X6oB9SotO dgUjcafC0+8PcsLQn8suGh9GS6Fr/GC1b6e6Fs7Ge2fgM5APA721rmbzPsLDRjNQQbpeu etQ002XUAK5mkpxqHfJmoIqhD0PBO0oCUJI11zBmovEsFcMoTa+G2hovpiKgXbGRRz8Qx K6/mRWnBx2+XV4/OYZbrERUJZoLf4gm9AkAfUfSrdx0vK3J1MbjrcHjyEfqA2hWyrHA== 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.176 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (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 31744606A332 for ; Sat, 28 Nov 2026 21:19:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 31744606A332 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-f176.google.com with SMTP id 5614622812f47-4a451915d8aso6494716b6e.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=NC1TltFA0wOwGQW3t7Av9ozyuMbfB0gFEtUFnE5NzYJrUqTy85SXSc67QxCD51QIoN XRsh5YH+mgjdtSk6fjuTWEQg4Tsd7L+/RNypvj49lfkuZi87Ar2jktcqA3SPEBPnF/ML fVM/HIwJ4NDWxPq1Q1vPLUj5mnu98EJP/Tgmaf62N/sQGo+wgFT35fmhVGpxck+MRS0/ bFReKmGgN9T6nBSwJnXXZiEa/HEhLnBk9R5XwOqRj1iYZpC1L6tK53u8dnPl6R9zYM2u diciIfuYJMbyCG5FquVNZ6HG+bnridFFWFQweAtGromvgeaklM/y4N66iJ3P7bpchncB MLEA== X-Gm-Message-State: APuU4Z/XcGIzqWQy11rrTmXIkgVO0XzO9/52psCOf7wgQzgDAzKlLFl+ C13mU987EBkEmhmTcZb2p8Yn1plj7eNR4mdDmUYsB+eZvDlXaL9xF2MP X-Gm-Gg: AZFdTZfyo4VaE+HBzx62PplI6pai0N1PNXI8Dm1sntHQPEEiPBFO5y557WQdoCj7Cz2 qcrFdHxIx+yyA7uocthgH+G38Mpm+RWNAsuls4laKKVVpKccRpkJvZ/ez/TA72nC+BBlUjGgK6G X/3qn37G+81cBYXNzieYDwRN0LpSY1Iao96V8a8dHg7suHDr6LCbXd961zyZfZ7kBD8w8hz5NO9 RIxabe4kdH5I8NBluIj0hW/Wiw7hfE8GdZbiFCZHMlHMkGwBS7slYDs1m89jjTQFGLIm2f4jMWf tXaUIPscCksahsmUqCsH1tNxZNR/0PvNVx5dOfXtVppOW6Iotk+DN+KE+kjNedQW5XJT+cjo3DA 8l3GMPRCewSRfa8yevtZaqmoQUsV/UuKrXH6dtPt3/5m8YFbmo3OBEFL4XCE6JizUszzubk2RH8 /PhTSHxrOlC47hPuYDFAGmT2aQ33Lo1oXTiXKtQ1aPyubdBf0nFbPE+34DQDFJEPZBO+/eQmqFD uex4E0a5UrVCQw4oGb9wPuHJHz4T+u9bUQhZWJ1Vd4EYWGUTNYCB4Rnt1MtfKwdYXagzVBPaBjb Kd7S63Poh24CIfv0FP7zvTgqHxYWYW7VEVidwb4GKfnvXAKSO5VcL8b/RqZO/02Mz9uIGPYCSmE mNn4L0YXLnN7inovMB2z8tMz+Bo2eaJKAhDWNkVKG4fq69qE= 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-ext4@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