From: Meng Xu <mengxu.gatech@gmail.com>
To: linux-fsdevel@vger.kernel.org
Subject: Possible data race on file->f_ra.ra_pages between generic_fadvise() and force_page_cache_readahead()
Date: Wed, 27 Nov 2019 17:23:59 -0500 [thread overview]
Message-ID: <CAAwBoOLO31qYBnUfOn30uHiKZgZbnP97XC3ij5tcrb2Ve4FK7A@mail.gmail.com> (raw)
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
reply other threads:[~2019-11-27 22:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAwBoOLO31qYBnUfOn30uHiKZgZbnP97XC3ij5tcrb2Ve4FK7A@mail.gmail.com \
--to=mengxu.gatech@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).