All of lore.kernel.org
 help / color / mirror / Atom feed
* Possible data race on file->f_ra.ra_pages between generic_fadvise() and force_page_cache_readahead()
@ 2019-11-27 22:23 Meng Xu
  0 siblings, 0 replies; only message in thread
From: Meng Xu @ 2019-11-27 22:23 UTC (permalink / raw)
  To: linux-fsdevel

Hi VFS developers,

There might exists cases where file->f_ra.ra_pages may race in
generic_fadvise() and force_page_cache_readahead().

Following is the execution trace

[Setup]
create("file_bar", 511) = 3;

[Thread 1]
fadvise64(3, 9055, 975, 2);
ksys_fadvise64_64
  vfs_fadvise
    generic_fadvise
      [WRITE] file->f_ra.ra_pages = bdi->ra_pages;

[Thread 2]
fadvise64(3, 9374, 3618, 3);
ksys_fadvise64_64
  vfs_fadvise
    generic_fadvise
      force_page_cache_readahead
        [READ] max_pages = max_t(unsigned long, bdi->io_pages, ra->ra_pages);

I could confirm dynamically that the order between [READ] and [WRITE]
is not deterministic (i.e., either may go first). However, they do not
lead to any crash or panics so I guess this might not be a serious
issue.

But just in case there may be unintended consequences, I am posting
this issue here for more visibility. Feel free to comment and discuss.

Best Regards,
Meng

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-27 22:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 22:23 Possible data race on file->f_ra.ra_pages between generic_fadvise() and force_page_cache_readahead() Meng Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.