serenity
serenity copied to clipboard
Kernel: Filesystem-Mounts hierarchy design is flawed
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:
- Because we know that
Ext2FSis backed by a DiskCache, as can be seen inBlockBasedFileSystemclass, 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. - The superblock and other components can be in a non-sync situation, which again, can lead to severe corruptions.
- 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! :)
This is not fixed yet.