From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=57.103.78.243 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796119860; b=sqgmDFlrR+UKOjcVdswGZMvpswN+NfDpew/8IR+SAaINruBY3DvVUlo7bkZ4W9w2gi8M kts+Fu8uHIgVaCIteAgZY809L5Fb1Qwa7My5LA+rtv0rSfBAvqgE6kQgSXLhPV6IVf8Aq 0HQGCAWdbZnTT7puu8mHSpt/VM5djhy7NP6dTp0V1JZgO8wEA9d1oKmSgWUjD1MzSC4OL QAaEfvuTFS1/7CCtTbziIRpZwwrjEGxUtV8rd1JmeNVR1LjWcfZl2DUf3sL3sFDFbdWzS JHNMalUJByj6R0a1Cbip7c4Dg7vxWL22ZgJNWeEaMaPXJC8my3lyRg4xSidI2cC7C+w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796119860; h=DMARC-Filter:Received:X-ICL-RepId:Dkim-Signature:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Authority-Info-Out:X-Proofpoint-Spam-Info: X-Proofpoint-GUID:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-ORIG-GUID:X-JNJ:X-Apple-Category-Label; bh=FwJJdQA95zsKZzsjo29KMaFlCBBRzJU9YFOs+icc2Ns=; b=xgz7Q/fFi+OjLAzWPN06ctBZCDJws7gSiEMSxivPtAxJl3sVAxb2jdjJ8Agk1nB1gRyI OrhjD41Ffixwfc30mZXnH3n/RlKA12RKB2eZdJgGetRsKdIrNkReLLUXAEWW/HAGYdP1j R1WWUUEafb6HvGXMBZp7Oo3ffvCD8wupu4bn/sNbzLeO4NoSK655kKNmlUjWMMdJ2jBDB eqIF+JrqWXdH5u8nqBvVug9C9AFzAMWG96hu1yB9hGRRofmnBoznsciY6LPoSj/W/PFJh dN06hpYvNk5+wqTG+rt8UkPYdZ3zTDUMNIRQgtHvWBjPHb4mkLrF24PVNgpMKER+Rzw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=W6sICGHR; arc=none smtp.remote-ip=57.103.78.243 Received: from outbound.st.icloud.com (st-2004h-snip4-2.eps.apple.com [57.103.78.243]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94989606A327 for ; Tue, 1 Dec 2026 10:10:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 94989606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=W6sICGHR Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-60-percent-5 (Postfix) with ESMTPS id 3963A18002D7; Tue, 01 Dec 2026 10:10:56 +0000 (UTC) X-ICL-RepId: 01a23116-040f-726e-8b31-c8ae36f98fca Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1796119858; x=1827655858; bh=FwJJdQA95zsKZzsjo29KMaFlCBBRzJU9YFOs+icc2Ns=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=W6sICGHRsrMhdicYW8hIKDEN+/xbNa+Kt06YACf5zyFz8niiT4kn/9dnAZe7A/J9FHwXW/H7s5XCT6IKQEb0WeDdbpqtklWme7+TMZCTOgD8McyiP9Ysy4ArgQ6WIh0lW0mYEdqdV1u/gvujx7O8s9/xtNxog59gcM5mWxu0EK1K4dv/cRXvuNwGBOp1mjXG9LFhQj56XW28PNXYzequkugtwIo1ULf5ILgA5DcrGl8H1hO6/LVUJTwnB/DmGDn5JGzkChSMvI9dcXVwQqfye2PucHhWYJqoP0YLlOvm7dWnCvT5oZxFsn4u12cc7wapJRwTuk20hDiXDyMlx38yXg== Received: from fedora (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-60-percent-5 (Postfix) with ESMTPSA id 1BD221800114; Tue, 01 Dec 2026 10:10:52 +0000 (UTC) From: "Yuxiang (Kurath) Ji" To: joannelkoong@gmail.com, miklos@szeredi.hu Cc: fuse-devel@lists.linux.dev, regressions@lists.linux.dev, linux-kernel@vger.kernel.org, jlayton@kernel.org, "Yuxiang (Kurath) Ji" Subject: [PATCH] fuse: keep a write-back error of the data for fsync and close in setattr Date: Tue, 1 Dec 2026 18:10:31 +0800 Message-ID: <20261201101031.2981145-1-kurath0307@icloud.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201100323.2958149-1-kurath0307@icloud.com> References: <20261201100323.2958149-1-kurath0307@icloud.com> 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 X-Authority-Info-Out: v=2.4 cv=AZQkjHXG c=1 sm=1 tr=0 ts=6b0e9d31 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=KCK4-79IMmdzQhB2:21 a=pUM-KoujPXoA:10 a=x7bEGLp0ZPQA:10 a=O1aR1u3RWL4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=4Xuvw5ty44FKcjjuTMQI:22 a=u51xplLbJFFac7_6oUtg:22 a=v3ZZPjhaAAAA:8 a=kR2e7WB4fnRnEPv3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IbKVhKSIKGvErTYBEfOZ41pj+7+POankYt+nSySW6hkMDHhD3Ypo+WULQiMG+9z8l oKmlCOf1ta10jYeJn8BwYysWy69OXCOzLSW+weJVwvpp9+QHgJ74gjc9eUD+7MplTAKZoX r9bzgxN+dUHrx9pMjDGcExSrPz6kFoJL0lN6hbC3yHLqVDGE2f/lj2Oyk3mzIWSdi/gK8q BBNW88BVsdnQD9nSvmLujJj7VU1hetqiOyzEC5ejAWQINudAwkd5cR5UIO/6STD4c/63NQ JqAqW06JMWZZDjmJLbKs9D8iFTshX1jNJQZ9xHVqMIqHRMGzdg42tjvhjgflZDf7cqNYKu ckiNcipJ5mABk890VqRK2jgquQOHjD8gGujwuVITlZrNpjDy8mT/qs/Ti24ti9MueCeomA SxRi7nM4qroa/L39ZEoisKd5j98/GmpL1r/gFionHdwx+pe3LC+BvxizuQPtyPKA0r3FdN V0aQxVInbYWb3F3mxya4kXx/2ZYIb8DkyB7Nf6oP0wohcaFB9pp52uS1x5rqL6uB6bvDgj FD1JNWOEgqr8doyusTf9BOpJV7fPCZuy7biaW34yxQLsJt4XEBvbnQQQfpGu4Hzj/Zj46I 9gWaFZc6c9Xyneq1fCoyR6lpN7/sJm3VCwfhSTIZSY+qnBpFcQuUMUXHZNeLOd3srAp205 XHmKUvIyDIMN8b+zjwLtKqMphWIMsJoAJSM32cviDnDcblnSFwwbWYcF50IRaWXlXprwi8 9twnWfj2hsRwK+jd7kWZo8jTjcJfmYCywcxg4LMOtJucDwzKvBZNUXGpHUNfYDcqY53FcO faJ45Bu8B4SV4qlaWPy/fbkofGhejppcESHYdC5TZYiU0w5V7U7KZ5ZRFU8t1AMJfaHK8U 5OY9qCgp7JKTCjy+K8rHOKK7aYKjsnuT3tAKHmyyUetqEtOvGeSXFOTgktgBEBm6L/oFxo 5yoCpzFX7tc5w= X-Apple-Category-Label: MjA0MDYyODMxODY6JGNhdGVnb3J5JF9QZXJzb25hbCw= Before a SETATTR that does not truncate, fuse_do_setattr() writes the inode out. Since commit 0c58a97f919c ("fuse: remove tmp folio for writebacks and internal rb tree") the write-back of a page ends only when the server has answered, so that write-out returns a failure of the data and clears the mapping's error flag, which fuse_flush() checks: the call that sets times or mode reports the failure, and the close() after it returns 0. A program that treats a failure to set times as cosmetic, such as mv across file systems, then takes its data for stored and removes the source. When the write-out fails and the mapping recorded a write-back error, leave the error on the mapping and go on with the change, so that fsync() and close() report it, as they did before that commit. NFS made the same choice for getattr in commit d19e0183a883 ("NFS: Do not report writeback errors in nfs_getattr()"). Found with a test FUSE file system that fails write-back requests, and reproduced with fuse-overlayfs over a full upper directory: since 6.16 mv across file systems warns about the times, exits 0 and removes the source. Building the commit above and its parent showed the change. Assisted by Claude Code. Tested on v7.4-rc5 in an x86_64 KVM guest with fuse-overlayfs 1.16: futimens() and fchmod() return 0 and the close() after them returns ENOSPC; mv reports the failed close, exits 1 and keeps its source; and the writer's fsync() still returns ENOSPC after a duplicate's close, a child's close or a child's exit that follows the attribute call. Fixes: 0c58a97f919c ("fuse: remove tmp folio for writebacks and internal rb tree") Signed-off-by: Yuxiang (Kurath) Ji --- fs/fuse/dir.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index a04d93d5f..895cd0e0a 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -2212,7 +2212,19 @@ int fuse_do_setattr(const struct mnt_idmap *idmap, struct dentry *dentry, attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_MTIME_SET | ATTR_TIMES_SET)) { + errseq_t since = filemap_sample_wb_err(inode->i_mapping); + err = write_inode_now(inode, true); + if (err && filemap_check_wb_err(inode->i_mapping, since)) { + /* + * The data failed to reach the server. That failure + * belongs to the file's data, not to this change of its + * attributes: leave it on the mapping for fsync() and + * close() to report, and go on with the change. + */ + mapping_set_error(inode->i_mapping, err); + err = 0; + } if (err) goto unlock; -- 2.56.1