Re: BUG: Mount ignores mount options

From: Andy Lutomirski
Date: Mon Aug 13 2018 - 12:49:23 EST


On Mon, Aug 13, 2018 at 9:35 AM, Alan Cox <gnomes@xxxxxxxxxxxxxxxxxxx> wrote:
>> If the same block device is visible, with rw access, in two different
>> containers, I don't see any anything good can happen. Sure, with the
>
> At the raw level there are lots of use cases involving high performance
> data capture, media streaming and the like.
>
> At the file system layer you can use GFS2 for example.

Ugh. I even thought of this case, and I should have been a bit more precise:

I would consider the GFS2 case to be essentially equivalent to the NFS
case. I think we can probably divide all the filesystems into three
or four types:

pseudo file systems: Multiple instantiations of the same fs driver
pointing at the same backing store give separate filesystems. (Same
backing store includes the case where there isn't any backing store.)
tmpfs is an example. This isn't particularly interesting.

network-like file systems: Multiple instantiations of the same fs
driver pointing at the same backing store are expected. This includes
NFS, GFS2, AFS, CIFS, etc. This is only really interesting to the
extent that, if the fs driver internally wants to share state between
multiple instantiations, it should be smart enough to make sure the
options are compatible or that it can otherwise handle mismatched
options correctly. NFS does this right.

non-network-like filesystems: There are complicated ones like btrfs
and ZFS and simple ones like ext4. In either case, multiple totally
separate instantiations of the driver sharing the backing store will
lead to corruption. In cases like ext4, we seem to support it for
legacy reasons, because we're afraid that there are scripts that try
to mount the same block device more than once, and I think the new API
has no need to support this. In cases like btrfs, we also seem to
support multiple user requests for "mounts" with the same underlying
block devices because we need it for full functionality. But I think
this is because our API is wrong.

Are there cases I'm missing? It sounds like the API could be improved
to fully model the last case, and everything will work nicely.