[Fstab] Ensure uniqueness for all filesystem types
ClosedPublic

Authored by bruns on Apr 1 2020, 4:57 PM.

Details

Summary

Commit a99c6136da2d ("Samba: Ensure to differenciate mounts sharing the
same source") only fixed the multiple mount problem for SMB share. This
can also happen for all other mounts (remounted local file systems,
NFS, ...).

Also clarify the comment.

Diff Detail

Repository
R245 Solid
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Apr 1 2020, 4:57 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 1 2020, 4:57 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Apr 1 2020, 4:57 PM
broulik accepted this revision.Apr 2 2020, 7:20 AM
This revision is now accepted and ready to land.Apr 2 2020, 7:20 AM
meven requested changes to this revision.EditedApr 2 2020, 8:11 AM

Good idea, we should fix this once and for all.
Two points though about udi form :

1/ Nfs udi would no be great.
For instance the source for nfs is usually of the form :
192.168.0.1:/export

With this we would have
192.168.0.1:/export:/mountpount

I suggest for the nfs source to remove the first ':' in the first place
To get :
192.168.0.1/export:mountpount for nfs

2/ For fuse mounts this removes the fstype from the udi, which is present currently for this case and handy.
So perhaps we would want to use the fstype :

nfs/192.168.0.1/export:mountpount for nfs
cifs//server/export:mountpoint for cifs (perhaps without the double slash)
fuse.type/source/export:mountpount for fuse
sftp/username@source/export:mountpoint for sftp

Perhaps event fstype:/ to make the fstype look like a protocol in the udi, i.e : fuse.type:/source/export:mountpount and sftp:/username@source/export:mountpoint for sftp
A complete udi would like like:
/orge/kde/fstab/sftp:/username@source/export:mountpoint

This revision now requires changes to proceed.Apr 2 2020, 8:11 AM
meven added a reviewer: sitter.Apr 2 2020, 8:11 AM
bruns added a comment.Apr 2 2020, 8:31 AM

Good idea, we should fix this once and for all.
Two points though about udi form :

1/ Nfs udi would no be great.
For instance the source for nfs is usually of the form :
192.168.0.1:/export

With this we would have
192.168.0.1:/export:/mountpount

I suggest for the nfs source to remove the first ':' in the first place
To get :
192.168.0.1/export:mountpount for nfs

Lots of mangling for IMHO no benefit. The UDI is not really visible for the user.

2/ For fuse mounts this removes the fstype from the udi, which is present currently for this case and handy.

It does not ...

meven accepted this revision.Apr 2 2020, 9:00 AM

Fine

This revision is now accepted and ready to land.Apr 2 2020, 9:00 AM
sitter requested changes to this revision.Apr 2 2020, 9:06 AM
sitter added inline comments.
src/solid/devices/backends/fstab/fstabhandling.cpp
131

mountpoints are not unique

This revision now requires changes to proceed.Apr 2 2020, 9:06 AM
bruns marked an inline comment as done.Apr 2 2020, 9:24 AM
bruns added inline comments.
src/solid/devices/backends/fstab/fstabhandling.cpp
131

Of course they are - you can just mount one fs at a path at any time.

bruns marked an inline comment as done.Apr 2 2020, 9:27 AM
sitter added inline comments.Apr 2 2020, 9:37 AM
src/solid/devices/backends/fstab/fstabhandling.cpp
131
λ ajax ~ → sudo mount -t cifs //bear.local/foo /mnt -o user=me              
λ ajax ~ → sudo mount -t cifs //bear.local/foo /mnt -o user=me
λ ajax ~ → sudo mount --bind /tmp /mnt             
λ ajax ~ → sudo mount --bind /tmp /mnt
λ ajax ~ → mount|grep /mnt                                    
//bear.local/foo on /mnt type cifs (rw,relatime,vers=3.1.1,cache=strict,username=me,uid=0,noforceuid,gid=0,noforcegid,addr=fd00:0000:0000:0000:8c8d:02ff:fec7:d6a4,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)
//bear.local/foo on /mnt type cifs (rw,relatime,vers=3.1.1,cache=strict,username=me,uid=0,noforceuid,gid=0,noforcegid,addr=2a03:c100:f100:4f00:8c8d:02ff:fec7:d6a4,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,user=me)
/dev/nvme1n1p1 on /mnt type btrfs (rw,relatime,ssd,space_cache,subvolid=1082,subvol=/@/tmp)
/dev/nvme1n1p1 on /mnt type btrfs (rw,relatime,ssd,space_cache,subvolid=1082,subvol=/@/tmp)

Wat. So maybe we need to add a hash of mount options to it? (Though I personally would call that pebkac)

bruns marked an inline comment as done.Apr 2 2020, 9:41 AM

Wat. So maybe we need to add a hash of mount options to it? (Though I personally would call that pebkac)

+1

src/solid/devices/backends/fstab/fstabhandling.cpp
131

The first mount is no longer visible, it is shadowed by the first one. You can not read any files from it or write to it. You can not unmount it.

bruns marked an inline comment as done.Apr 2 2020, 9:43 AM
sitter added inline comments.Apr 2 2020, 9:47 AM
src/solid/devices/backends/fstab/fstabhandling.cpp
131

The comment is still wrong.

bruns marked an inline comment as done.Apr 2 2020, 10:01 AM
bruns added inline comments.
src/solid/devices/backends/fstab/fstabhandling.cpp
131

You let the old comment pass without any further remarks, but now you start nitpicking?

From the acessibility viewpoint of the mount, it is unique.

sitter added inline comments.Apr 2 2020, 10:13 AM
src/solid/devices/backends/fstab/fstabhandling.cpp
131

The previous comment was factually correct, it never claimed the same source on the same mount would be differentiated. Your comment on the other hand does and it's wrong. It's doesn't say it's unique for the purposes of presentation or anything. It says mountpoints are unique. But they are not.
I got the impression you liked nitpicking. Guess only when the shoe is on the other foot.

sitter accepted this revision.Apr 2 2020, 10:14 AM
This revision is now accepted and ready to land.Apr 2 2020, 10:14 AM
bruns marked an inline comment as done.Apr 2 2020, 10:21 AM
bruns added inline comments.
src/solid/devices/backends/fstab/fstabhandling.cpp
131

I got the impression you liked being lax. Guess only when the shoe is on the other foot.

This revision was automatically updated to reflect the committed changes.
sitter added inline comments.Apr 2 2020, 10:55 AM
src/solid/devices/backends/fstab/fstabhandling.cpp
131

I do like being lax! I literally gave you a ship it despite your comment being literally wrong.
Picking on useless crap such as whether a comment is technically entirely correct or not doesn't give anything of value to anyone except the person picking, who is really just getting an air of superiority I'm sure. The rest of the world meanwhile gets their time wasted. You seem to not appreciate that, and I'll clearly not make you see it either. One of many great failures of mine, right next to wanting things get done.

meven added a comment.EditedApr 15 2020, 4:06 PM

A consequence of this is the deviceName is used in fstab device description :

In dolphin:


Making planner the need for D28590