On 2022-04-27 11:39:17 +0200, Thomas Schmitt wrote:
> It is normal that data get onto the physical storage medium only quite a
> long time after a program wrote them. But this is supposed to be kept
> consistent by the VFS and virtual memory of the Linux kernel.
[...]
> I understand that the filesystem driver writes to memory pages which
> are associated to storage device memory. The pages and their association
> are managed by the virtual memory facility of the kernel.
>   
> https://www.kernel.org/doc/html/latest/filesystems/vfs.html#the-address-space-object
> Any attempt to access the associated to storage device memory of a not
> yet written page is supposed to be directed to the cached page in RAM.

If I understand correctly, the VFS does not just have cached pages,
but also its own structures, like inodes. So, I'm wondering whether
the following could be possible:

* openat(AT_FDCWD, "….out", O_WRONLY|O_CREAT|O_TRUNC, 0666) creates
  a file in the VFS, which is not written back to the actual FS.

* The subsequent openat(AT_FDCWD, "….out", O_WRONLY|O_CREAT|O_APPEND, 0666)
  append data to this file in the VFS, still not written back to the
  actual FS.

When I did

  tail -n 30 mpfrtests.*.out; ll mpfrtests.*.out

this had the effect to look at the entries in the current directory.
For some reason (a bug occurring under some particular conditions?),
the dirty state due to the data written above to the VFS was ignored,
so that the file was not found. Ditto for the first "lt|head".

Between the first "lt|head" and the second one, the data were written
back to the actual FS.

This explanation is possible only if the birth time is the time at
which the VFS inode was written as the inode of the actual FS, not
the time at which the file was created in the VFS. This may be the
case, as the VFS does not seem to have the concept of birth time
(fs/inode.c has things like atime, ctime and mtime, but that's all).

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to