Re: [PATCH] xfs: Remove i_rwsem lock in buffered read

From: Christoph Hellwig
Date: Tue Jan 07 2025 - 12:14:44 EST


On Tue, Jan 07, 2025 at 01:13:17PM +0100, Amir Goldstein wrote:
> The issue with atomicity of buffered I/O is the xfs has traditionally
> provided atomicity of write vs. read (a.k.a no torn writes), which is
> not required by POSIX standard (because POSIX was not written with
> threads in mind) and is not respected by any other in-tree filesystem.

That is true for original Posix, but once Posix Threads joined the game
the behavior was and still is required. See "2.9.7 Thread Interactions
with Regular File Operations" here:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html

Now most Linux filesystems ignored that and got away with ignoring
the requirement, but it still exists.