From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=57.103.78.162 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796119423; b=CYegOXHsU7ZKkfZ5JKq8sgqrnT23GKkJhPX4x5QEt3Qv6LYuPcdBGdydww81kczSgTwQ 1/zCcRIITxmFNY/s3Qy83oYfDZyH7y4I0ln7rFihdNDLR+4/SOSqUcWEipkMm11N3Og7n iUH8M5oyghHcfwP5eH5i7xCJe9VNTece8OVY8hDbdWVfFpd+djQlpCn2LljKn1sU2NP8m yZ6Zo1qCZmGoLz5jHBs9c616z1TKR7gfvCFEVjJmF8A1WQwou5vWmhgptYuWBVdzTfXHl n6lkURJni8vYnIxTZQzQftgQUAVICrMVtJcU0/iTBlGFd6mRfg25WiDbOMXvyfayH7w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796119423; h=DMARC-Filter:Received:X-ICL-RepId:Dkim-Signature:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding:X-Proofpoint-Spam-Info:X-Proofpoint-GUID: X-Authority-Info-Out:X-Proofpoint-ORIG-GUID: X-Proofpoint-Spam-Details-Enc:X-JNJ; bh=ykOBiwcT5jOUoAwdVxrJHfTBYZF3nqsnHLG9XkRt5oc=; b=X6gJJ6hZ4Yq9pMFKEoMvrSEtxQ2BBTh8p5YhBHmxMUxN6cpwOHLS1YbrR2VNpMnvhBgO eZtj502C++eeLxaKtzZVZF/1IadVoivkowcsFXp6SCuzu3hQoF2i1MFljb90FYooIFx9b xZ77EnGBz5FsScqBjodA1Klzlz4Vt/W40YVKHFAipWq8CVnBJ3To2U3siG+nIl6s6cgaQ uANmpC5JoSsIdpwWP2UXr8NKP1Rrqj5zcf+vOj4TlPPhGpePCHaU9dWPUj2+RoxCvMfpV v6F1HvQ8dlarHIgU+zcttgAAaCqACB90rtaFZzB0nG7ZlMweDHwnIFMfijGS5NP+YKw== 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=ESBiRYJx; arc=none smtp.remote-ip=57.103.78.162 Received: from outbound.st.icloud.com (st-2004b-snip4-1.eps.apple.com [57.103.78.162]) (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 EF482606A32E for ; Tue, 1 Dec 2026 10:03:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EF482606A32E 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, unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=ESBiRYJx Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-10-percent-2 (Postfix) with ESMTPS id BB94618023CC; Tue, 01 Dec 2026 10:03:39 +0000 (UTC) X-ICL-RepId: 01a2310f-5b04-7b73-a8c1-737b6bd76c8a Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1796119422; x=1827655422; bh=ykOBiwcT5jOUoAwdVxrJHfTBYZF3nqsnHLG9XkRt5oc=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=ESBiRYJxl1gdxaOMwhbHOEplOeIRguaMJ974EAnAw4i/HUdUwjlghuhdqjzjXvXPr8/J07r41rUs/GwTADiL1Xt4m+armMczg5nJMLXtGqBBF3W9A6NGfqyBJP77pHkp23PgtMweqTzaSDwwMN7OqUktwAXmIgPSh+SNHI2ZHR1ssmgpYXl4dGIIRY6q59sE3S+rTVp7ytFOGgLFLP5/A4ybxjFruo+0tmTRcH+ETnGkxTTu60Yr6NHahirvm7PUyIATW1h0X2ITFMOhZodr9zPJsuWGCygf6UDXs+udyNpIJ5QRs7mBdlf9ZTpwCj0BCzSTJ7PJmoZ6T8Ol01pggQ== Received: from fedora (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-10-percent-2 (Postfix) with ESMTPSA id DD27118001A5; Tue, 01 Dec 2026 10:03:35 +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 Subject: [REGRESSION] fuse: since 6.16 an attribute change takes the write-back error and close() returns 0 Date: Tue, 1 Dec 2026 18:03:23 +0800 Message-ID: <20261201100323.2958149-1-kurath0307@icloud.com> 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 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDAzOSBTYWx0ZWRfXy7KVQn3ajVM8 KuIGPLXdPyEfF9ac7y0UB5rUROPspqAzD5g0bWDIeLivAo0cvBS6lpRGC+OT900VfcQr/ClUGr5 qcjitPJvgDfGT+Z5qmfi5TVpbzvz4Rw= X-Proofpoint-GUID: VEOmTZLMawXBw6m_EbrBlbHVxXaz5ktP X-Authority-Info-Out: v=2.4 cv=Q9lHcI2a c=1 sm=1 tr=0 ts=6b0e9b7c cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=pUM-KoujPXoA:10 a=x7bEGLp0ZPQA:10 a=O1aR1u3RWL4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QaeLmmkvmy3w6PnwmP/iqA/y Tx6//WvWUxGYXSPD47eeIUSz3n4rfNJeQ03vXXt9GJtMdawZJ3HEWlbUzrCJkFjnHRzfMQ M9gMArKrHvlbVDGZrdZQzBtuzGUTberIJo2W5MABkxnhiH0MINwu2PUU9nnZYQuaLjnAnS aBmetna5NpAKHXSjo+nR6YG7sOoP/vZBfWmwO8CF6LkX7Icy/3P8iPXD56uyY6FZxfy1IK qKZ77aS7qDGv10oE9kZechwPInurGy6aAc2dJBYuFSAuGScF06Q02VYHTq4LaRbGpxChLA Hnn+X3o6pFFSeuOPsAiUJ9WTykZumUBekeGBKFsRnYGPFfQdFCweWO/smxGYxnQRyACR7A MD3nhbpi441cP9iQ1fMJ5UI46HUs6d8GHlM2ulVJr8f4bYVxLmzZJAbESTm3eAPEC9+Nm4 +fRfCLMHUOAhq5rroCyIJHjERJtMStk44iOMGnlveyVty7LSZHGes/yIgt9iTN4XBBf/Z4 c/5FgoLOAaaq6OW7e7mCqwo574VCyg7FkdT2Id3UXrK3mGs5sbj/JXElma81QjqLm8zTOL wOKKIlIWNtkfXlCEbYaqfUahP8LIiHQZVbEMHNzVyMzWNccQi8gzPBaz7dIpkHdoEJP4aB aqvoIuC7DOJM73w3C/nDStcU+yHnpqliD4nf+7PAxfuPJd+G0qTrLpLVA2vhXFq9sqs/Pv /MnsEfDpFxt2Hf0BZqz/vCqVqD/xIbRnUTSag+LAu9i/2IL+NbcpTT5kbi/AUA9cRfeL+e BcCFJHDjYmaebXwvzKX7x7EyaMq8sSd0oNtiQZBhcU9BP6NmFYYZRtd2ygRcd3B2ZR9ZHK akX64f/gmE7f4UDq2fT+v+IPAgM6lUjKU= Hello, On a FUSE file system with the write-back cache, a program that writes a file, then sets its times or mode through the descriptor (futimens(), fchmod()), then closes it, was told about a failed write-back by close() up to 6.15. Since 6.16 the attribute call returns the error and close() returns 0. Programs that treat a failure to set times or mode as a warning now report success for data that was not stored. mv across file systems (GNU coreutils 9.10 and 9.12) is one: it warns "preserving times ...: No space left on device", removes the source and exits 0, so the only copy of the file is lost. gzip removes its input the same way, with its warning exit status 2. Last good: v6.15 (Fedora's 6.15.10). First bad: v6.16 (Fedora's 6.16.12), with the same image. Building 0c58a97f919c ("fuse: remove tmp folio for writebacks and internal rb tree") and its parent 0c4f8ed498ce with one configuration, the change follows the commit: kernel write, futimens, close write, fchmod, close mv parent futimens 0, close ENOSPC fchmod 0, close ENOSPC exit 1, source kept 0c58a97f919c futimens ENOSPC, close 0 fchmod ENOSPC, close 0 exit 0, source removed v7.4-rc5 futimens ENOSPC, close 0 fchmod ENOSPC, close 0 exit 0, source removed On all three kernels, close() directly after write() returns ENOSPC, and so does fsync(). The change acts while the file still has cached data at the attribute call, as when mv sets the times right after the copy. With files of 16 KiB to 1 GiB and 0 to 40 seconds between the last write and futimens(), ten runs each: on the parent, close() returned ENOSPC in 200 of 200 runs, after the attribute call had returned it too in 74 of them (files of 16 MiB and more), and mv kept its source in 30 of 30 moves of up to 256 MiB; on 0c58a97f919c, close() returned it in 0 of 50 runs with no delay and in 50 of 50 after 40 seconds, when the kernel had written the file back already, and mv lost its source in 30 of 30. virtiofs behaves the same when virtiofsd runs with --writeback: in a 6.19 guest whose shared directory was full, mv warned, removed the source and exited 0. Why: fuse_do_setattr() writes the inode out with write_inode_now() before a non-truncating SETATTR (fs/fuse/dir.c, around line 2215 in v7.4-rc5). Since 0c58a97f919c the write-back of a page ends when its request has ended, so that write-out now waits for the server's answer and returns the error, and in doing so clears AS_EIO/AS_ENOSPC on the mapping. fuse_flush() checks the mapping with filemap_check_errors() (fs/fuse/file.c, line 494), finds nothing, and close() returns 0. fuse_fsync() uses file_check_and_advance_wb_err() (line 587), which is why fsync() through the writer's descriptor still reports. Before the commit, the write-back of a page ended as soon as the temporary copy was queued, the attribute call's write-out returned before the answer, and the error was recorded later, for close() to find. A fix: when the write-out in fuse_do_setattr() fails and the mapping recorded a write-back error, leave the error on the mapping and go on with the attribute change, so that fsync() and close() report it as before. NFS made the same choice for getattr in d19e0183a883 ("NFS: Do not report writeback errors in nfs_getattr()"). The patch in the reply does this. With it, on v7.4-rc5, futimens() and fchmod() return 0 and close() returns ENOSPC; mv says "failed to 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 (9 of 9 runs). Over the grid above, run on v7.4-rc3 with the same patch, close() returned ENOSPC in 200 of 200 runs and the attribute call in none. Another possible fix lets fuse_flush() also check the file's errseq cursor without advancing it. Tried on the same grid, it gives close() the error back too, but the attribute call still returns it, so a program that checks both is told twice (the attribute call in 138 of the 200 runs). To reproduce, as an ordinary user (fuse-overlayfs, here 1.16, over an upper directory on a full tmpfs, mounted in a user namespace; Python 3 for the calls): #!/bin/sh set -e work=$(mktemp -d) trap 'rm -rf "$work"' EXIT cd "$work" cat > calls.py <<'PYEOF' import errno, os, sys def result(f): try: r = f() return "0" if r is None else str(r) except OSError as e: return errno.errorcode.get(e.errno, str(e.errno)) steps = {"futimens": lambda fd: os.utime(fd, (0, 0)), "fchmod": lambda fd: os.fchmod(fd, 0o644), "fsync": os.fsync} for case in sys.argv[2:]: fd = os.open(os.path.join(sys.argv[1], case), os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o644) out = ["write " + result(lambda: os.write(fd, b"x" * (1 << 20)))] if case in steps: out.append(case + " " + result(lambda: steps[case](fd))) out.append("close " + result(lambda: os.close(fd))) print("; ".join(out)) PYEOF unshare --user --map-root-user --mount sh -c ' set -e mkdir low back mnt src mount -t tmpfs -o size=8m tmpfs back mount -t tmpfs -o size=8m tmpfs src mkdir back/upper back/work fuse-overlayfs -o lowerdir=$PWD/low,upperdir=$PWD/back/upper,workdir=$PWD/back/work "$PWD/mnt" head -c 1048576 /dev/urandom > src/file # Fill the file system under the upper directory. head -c 16777216 /dev/zero > back/filler 2>/dev/null || true python3 calls.py mnt alone futimens fchmod fsync status=0 mv src/file mnt/moved > mv.err 2>&1 || status=$? echo "mv: exit status $status; source still there: $(test -e src/file && echo yes || echo no); stderr: $(head -c 100 mv.err | tr "\n" " ")" fusermount3 -u mnt ' Output on v7.4-rc5 (x86_64 KVM guest, Fedora 44 user space): write 1048576; close ENOSPC write 1048576; futimens ENOSPC; close 0 write 1048576; fchmod ENOSPC; close 0 write 1048576; fsync ENOSPC; close 0 mv: exit status 0; source still there: no; stderr: mv: preserving times for 'mnt/moved': No space left on device On the parent of 0c58a97f919c the second and third lines read "futimens 0; close ENOSPC" and "fchmod 0; close ENOSPC", and mv says "failed to close 'mnt/moved': No space left on device", exits 1 and keeps its source. Assisted by Claude Code. #regzbot introduced: 0c58a97f919c