* [Bug 205571] New: potential data race on ext4_setattr around inode->i_mtime with ftruncate and readv
@ 2019-11-18 22:23 bugzilla-daemon
0 siblings, 0 replies; only message in thread
From: bugzilla-daemon @ 2019-11-18 22:23 UTC (permalink / raw)
To: linux-ext4
https://bugzilla.kernel.org/show_bug.cgi?id=205571
Bug ID: 205571
Summary: potential data race on ext4_setattr around
inode->i_mtime with ftruncate and readv
Product: File System
Version: 2.5
Kernel Version: 5.4-rc5
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: ext4
Assignee: fs_ext4@kernel-bugs.osdl.org
Reporter: mengxu.gatech@gmail.com
Regression: No
I am bringing up the visibility of a potential data race on ext4_setattr around
inode->i_mtime when one thread is doing ftruncate and the other readv.
[Setup]
creat(file_bar, 0777, ) = 4;
dup2(4, 198) = 198;
link(file_bar, link_bar) = 0;
open(link_bar, 0x2, 0777) = 6;
dup2(6, 196) = 196;
[Thread 1] ftruncate(198, 21009);
[Thread 2] readv(196, [{iov_base=0x0x7fa652a1fa07, iov_len=1641}, ,..], 6);
The function call trace is shown below:
[Thread 1: SYS_ftruncate]
__do_sys_ftruncate
do_sys_ftruncate
do_truncate
ext4_setattr
[WRITE] inode->i_mtime = current_time(inode);
[Thread 2: SYS_readv]
__do_sys_readv
do_readv
vfs_readv
do_iter_read
do_iter_readv_writev
call_read_iter
ext4_file_read_iter
generic_file_read_iter
generic_file_buffered_read
file_accessed
atime_needs_update
relatime_need_update
[READ] if (timespec64_compare(&inode->i_mtime,
&inode->i_atime) >= 0)
I could confirm that the WRITE may happen before and after the READ operation
by controlling the timing of the two threads, i.e., by setting breakpoints
before the WRITE statement.
However, I am not very sure about the implication of such a data race (e.g.,
causing violations of assumptions). I would appreciate if you could help check
on this potential bug and advise whether this is a harmful data race or it
is intended. Thank you!
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-18 22:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 22:23 [Bug 205571] New: potential data race on ext4_setattr around inode->i_mtime with ftruncate and readv bugzilla-daemon
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).