ltp icon indicating copy to clipboard operation
ltp copied to clipboard

msync01:testcase need revisit

Open huilinzh opened this issue 3 months ago • 5 comments

Source code: kernel/syscalls/msync/msync01.c

If run the command "msync01" without any options, the test tries to do the following:

  1. open/create a file
  2. mmap this file
  3. memset part of the mapped memory to "1" for this file
  4. msync the mapped memory to this file
  5. lseek the file to the position, which is memset to "1" in above step 3.
  6. read the file and compare the value

In step 4, msync is called with flag MS_ASYNC. This flag means an update be scheduled, but the call to msync returns immediately. That's it doesn't guarantee the synchronization is completed before the msync() return. So the comparation in step 6 may succeed or fail. The test result can't be expected to be always successful.

huilinzh avatar Sep 12 '25 01:09 huilinzh