Re: File name is not persisted if opened with O_SYNC and O_TRUNC flags

From: Vyacheslav Kovalevsky

Date: Fri Feb 13 2026 - 05:25:54 EST


On 13/02/2026 10:33, Christoph Hellwig wrote:
On Thu, Feb 12, 2026 at 02:51:47PM +0300, Vyacheslav Kovalevsky wrote:
Detailed description ==================== Hello, there seems to be an issue with O_SYNC flag when used together with O_TRUNC on various file systems. Opening a file with O_SYNC (or using fsync(fd)) should persist directory entry.
No, it should not. I'm not sure who hallucinated, but O_SYNC has always always applied to persistency semantics after writes and nothing else.
You are right, opening file with O_SYNC does not persist anything and ftruncate or O_TRUNC do not count as write I/O it seems. Also found an error related to these assumptions in our testing tool. Thanks.