lkml.org 
[lkml]   [2020]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: KCSAN: data-race in generic_file_buffered_read / generic_file_buffered_read
On Wed, Jul 15, 2020 at 11:54:54PM -0700, Eric Biggers wrote:
> > >> > Concurrent reads on the same file descriptor are allowed. Not with sys_read(),
> > >> > as that implicitly uses the file position. But it's allowed with sys_pread(),
> > >> > and also with sys_sendfile() which is the case syzbot is reporting here.
> > >>
> > >> Concurrent read()s are fine, they'll just read from the same offset.
> > >>
> > >
> > > Actually the VFS serializes concurrent read()'s on the same fd, at least for
> > > regular files.
> >
> > Hmm, where?
>
> It's serialized by file->f_pos_lock. See fdget_pos().

What if we trylock either f_lock or f_pos_lock for readahead and just
skip all the readahead code if it's already taken? I'd suggest that if
there are two readers using the same struct file, this is probably not
a workload that benefits greatly from readahead.

\
 
 \ /
  Last update: 2020-07-16 15:20    [W:0.067 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site