[LU-14922] mmap read of writable mapping updates mtime Created: 09/Aug/21 Updated: 18/Mar/22 |
|
| Status: | Open |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Patrick Farrell | Assignee: | Patrick Farrell |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Severity: | 3 |
| Rank (Obsolete): | 9223372036854775807 |
| Description |
|
Generating a read fault (ie, reading) from a memory mapped file mapped with PROT_WRITE updates mtime. This is incorrect (compare with behavior of other POSIX file systems). This seems to be related to how we handle the difference between a writable mapping and a mkwrite operation - There is an oddity where ll_fault_io_init is called and sets ft_writable by directly checking the vm_flags, but mkwrite also sets ft_writable directly. This is definitely strange and should be cleaned up, but it's not clear to me if it's the issue - a read of a writable mapping doesn't cause a mkwrite, it's still just a page fault. But it could be we're not handling this correctly - this is unclear to me. In any case, the specific bug is that reading a writable mmap updates mtime, which it should not. |
| Comments |
| Comment by Patrick Farrell [ 17/Mar/22 ] |
|
qian_wc, bobijam did one of you fix this issue in another patch? I think I remember that but I can't find it right now. |
| Comment by Qian Yingjin [ 18/Mar/22 ] |
|
I did not fix this issue IIRC. After dig the code, the problem is caused by:
osc_io_fault_start() ->
if (fio->ft_writable)
osc_page_touch_at(env, ios->cis_obj,
fio->ft_index, fio->ft_nob);
osc_page_touch_at()->
attr->cat_mtime = attr->cat_ctime = ktime_get_real_seconds();
valid = CAT_MTIME | CAT_CTIME;
|