[lkml]   [2020]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: the "read" syscall sees partial effects of the "write" syscall
On Fri 18-09-20 08:25:28, Mikulas Patocka wrote:
> I'd like to ask about this problem: when we write to a file, the kernel
> takes the write inode lock. When we read from a file, no lock is taken -
> thus the read syscall can read data that are halfway modified by the write
> syscall.
> The standard specifies the effects of the write syscall are atomic - see
> this:

Yes, but no Linux filesystem (except for XFS AFAIK) follows the POSIX spec
in this regard. Mostly because the mixed read-write performance sucks when
you follow it (not that it would absolutely have to suck - you can use
clever locking with range locks but nobody does it currently). In practice,
the read-write atomicity works on Linux only on per-page basis for buffered


Jan Kara <>

 \ /
  Last update: 2020-09-18 15:14    [W:0.092 / U:5.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site