serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Kernel: Filesystem-Mounts hierarchy design is flawed

Open supercomputer7 opened this issue 3 years ago • 1 comments

I put this mainly as a reminder for myself to work on this, however, if you want to do that as well, feel free to do this!

Let's consider the following example to demonstrate the problem I'm pointing on: A user boots up the system which by default mounts a disk device to /. This might be represented also as a block device on /dev. The user creates a folder called /mnt and wants to mount that device again (mount /dev/hda /mnt). We create an Ext2FS object when doing that, which seems like a "new" filesystem to the Kernel. This scenario leads to quite few problems:

  1. Because we know that Ext2FS is backed by a DiskCache, as can be seen in BlockBasedFileSystem class, this could lead to duplication in what DiskCache we hold at one moment, which could also lead to severe corruptions when the filesystem sync process is running to write cache (flushing) back to disk.
  2. The superblock and other components can be in a non-sync situation, which again, can lead to severe corruptions.
  3. Flags of mount which are filesystem specific (in linux, for example, discard is a filesystem-specific mount flag) are not applied to all instances which can lead to silent corruptions (imagine what happens if we could send a TRIM command on a device that actually corrupts data because of that bug in its controller, but we can't be sure because we have instances that allow it to happen when we debug it).

Therefore, I think we should change the hierarchy. I'm not sure how it should be built really and I'm working on creating a solution for this problem. Any suggestions for a solution is always appreciated! :)

supercomputer7 avatar Dec 17 '21 03:12 supercomputer7

This is not fixed yet.

supercomputer7 avatar Jun 17 '22 08:06 supercomputer7