Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

many: add x-gvfs-hide option to mount units #10104

Merged
merged 1 commit into from Apr 6, 2021

Conversation

lhotari
Copy link
Contributor

@lhotari lhotari commented Apr 1, 2021

Use x-gvfs-hide mount option to hide squashfs loopback devices in Gnome gvfs

- x-gvfs-hide mount option should be used to hide block devices in
Gnome gvfs. This is documented in
https://gitlab.gnome.org/GNOME/gvfs/blob/master/monitor/udisks2/what-is-shown.txt

- gvfs-udisks2-volume-monitor uses a lot of CPU when there are a lot of
  mount loopback devices unless the loopback devices are hidden from udisks2
  with x-gvfs-hide or udev rule containing ENV{UDISKS_IGNORE}="1"
@lhotari lhotari changed the title Replace x-gdu.hide mount option with x-gvfs-hide Use x-gvfs-hide mount option Apr 1, 2021
@lhotari lhotari changed the title Use x-gvfs-hide mount option Use x-gvfs-hide mount option to hide squashfs loopback devices in Gnome gvfs Apr 1, 2021
Copy link
Collaborator

@zyga zyga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good

I wonder if the name x-gvfs-hide needs to become x-gvfs.hide at some point, as that's the standard for custom options. But this is not an impact on this PR, +1.

@lhotari
Copy link
Contributor Author

lhotari commented Apr 1, 2021

This looks good

I wonder if the name x-gvfs-hide needs to become x-gvfs.hide at some point, as that's the standard for custom options. But this is not an impact on this PR, +1.

x-gvfs-hide is the correct option name. I was initially going to replace the existing x-gdu.hide, but ended up keeping it since I don't know if libgtop supports x-gvfs-hide. The x-gdu.hide option was added by #4294 .

@lhotari lhotari changed the title Use x-gvfs-hide mount option to hide squashfs loopback devices in Gnome gvfs Mount with x-gvfs-hide option Apr 1, 2021
Copy link
Contributor

@stolowski stolowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for this!

@mvo5
Copy link
Contributor

mvo5 commented Apr 1, 2021

This looks great, thanks for this! We would love to merge but it appears that the CLA is not signed, would you mind signing it please? The details are here: https://ubuntu.com/legal/contributors - thanks a lot!

@lhotari
Copy link
Contributor Author

lhotari commented Apr 1, 2021

This looks great, thanks for this! We would love to merge but it appears that the CLA is not signed, would you mind signing it please? The details are here: https://ubuntu.com/legal/contributors - thanks a lot!

Hi @mvo5 , I already signed it. Did you find it somewhere? I didn't know what to put in the "Canonical Product manager or contact" field so I put "snapd" there.

@anonymouse64 anonymouse64 changed the title Mount with x-gvfs-hide option many: add x-gvfs-hide option to mount units Apr 2, 2021
@anonymouse64
Copy link
Member

hi @lhotari the CLA check sometimes takes a few hours to synchronize everywhere, but it looks good now. I renamed your PR title to match our CI checks now so that the rest of our test suite runs. Thanks for the contribution!

Copy link
Collaborator

@bboozzoo bboozzoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bboozzoo bboozzoo added this to the 2.49 milestone Apr 6, 2021
@bboozzoo
Copy link
Collaborator

bboozzoo commented Apr 6, 2021

@mvo5 I think w can land it, the failures are unrelated. Also, added 2.49 milestone if we do .3.

@mvo5 mvo5 merged commit b3a9769 into snapcore:master Apr 6, 2021
@ktsakalozos
Copy link

Hi, has this been released?

I am on

$ snap --version
snap    2.53.2
snapd   2.53.2
series  16
ubuntu  20.04
kernel  5.4.0-91-generic

I see this:

$ mount | grep squash
/var/lib/snapd/snaps/core18_2246.snap on /snap/core18/2246 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core20_1169.snap on /snap/core20/1169 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/microk8s_2693.snap on /snap/microk8s/2693 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/multipass_6130.snap on /snap/multipass/6130 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snapcraft_6751.snap on /snap/snapcraft/6751 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/microk8s_2636.snap on /snap/microk8s/2636 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core20_1242.snap on /snap/core20/1242 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snapd_13640.snap on /snap/snapd/13640 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core18_2253.snap on /snap/core18/2253 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snapd_14066.snap on /snap/snapd/14066 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snapcraft_6954.snap on /snap/snapcraft/6954 type squashfs (ro,nodev,relatime,x-gdu.hide)

I would expect the x-gvfs-hide to be present.

@bboozzoo
Copy link
Collaborator

bboozzoo commented Dec 6, 2021

Hm on my opensuse box:

$ mount|grep core_11993
/var/lib/snapd/snaps/core_11993.snap on /snap/core/11993 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)

$ systemctl cat snap-core-11993.mount 
# /etc/systemd/system/snap-core-11993.mount
[Unit]
Description=Mount unit for core, revision 11993
Before=snapd.service
After=zfs-mount.service

[Mount]
What=/var/lib/snapd/snaps/core_11993.snap
Where=/snap/core/11993
Type=squashfs
Options=nodev,ro,x-gdu.hide,x-gvfs-hide <----- but present here?
LazyUnmount=yes

[Install]
WantedBy=multi-user.target

So there is something fishy going on. The option is not listed in mounts, but is listed in the mount unit.

I've collected the output with LIBMOUNT_DEBUG=all:

5223: libmount:      CXT: [0x55b5f7931bd0]: fstab not required -- skip                                    
5223: libmount:      CXT: [0x55b5f7931bd0]: merging mount flags                                           
5223: libmount:      CXT: [0x55b5f7931bd0]: final flags: VFS=00000005 user=00002000                       
5223: libmount:      CXT: [0x55b5f7931bd0]: mount: evaluating permissions                                 
5223: libmount:      CXT: [0x55b5f7931bd0]: mount: fixing options, current vfs: 'nodev,ro' fs: '(null)' user: 'x-gvfs-hide,x-gdu.hide,x-canary', optstr: 'nodev,ro,x-gvfs-hide,x-gdu.hide,x-canary'
5223: libmount:      CXT: [0x55b5f7931bd0]: mount: fixing vfs optstr                                      
5223: libmount:      CXT: applying 0x00000005 flags to 'nodev,ro'                                         
5223: libmount:      CXT: new optstr 'ro,nodev'                                                           
5223: libmount:      CXT: [0x55b5f7931bd0]: mount: fixing user optstr                                     
5223: libmount:      CXT: applying 0x00002000 flags to 'x-gvfs-hide,x-gdu.hide,x-canary'                                                                                                                             
5223: libmount:      CXT: new optstr 'x-gvfs-hide'                                                        
5223: libmount:      CXT: [0x55b5f7931bd0]: fixed options [rc=0]: vfs: 'ro,nodev' fs: '(null)' user: 'x-gvfs-hide', optstr: 'ro,nodev,x-gvfs-hide'
5223: libmount:      CXT: [0x55b5f7931bd0]: preparing source path                                         
5223: libmount:      CXT: [0x55b5f7931bd0]: srcpath '/var/lib/snapd/snaps/core_11993.snap'                
5223: libmount:    CACHE: [0x55b5f7931f40]: alloc                                                         
5223: libmount:    CACHE: [0x55b5f7931f40]: canonicalize path /var/lib/snapd/snaps/core_11993.snap  

Looks like libmount has stripped some options, so it eiether has opinions on what the proper format is, or there's a bug in libmount. I understand that this option is needed for gvfs, please verify the behavior on Ubuntu and file a bug in LP. for the appropriate component.

@atesburak
Copy link
Contributor

Nothing extra but the behavior seems to be the same in case of snapfuse as well

# mount | grep snapfuse
snapfuse on /snap/core18/2253 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/core18/2246 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/core20/1242 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/lxd/21803 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/core20/1270 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/lxd/21835 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/snapcraft/7003 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/snapd/14066 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/snapd/14295 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/snapcraft/7010 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
snapfuse on /snap/core/11993 type fuse.snapfuse (ro,nodev,relatime,user_id=0,group_id=0,allow_other)
# systemctl cat snap-core-11993.mount 
# /etc/systemd/system/snap-core-11993.mount
[Unit]
Description=Mount unit for core, revision 11993
Before=snapd.service
After=zfs-mount.service

[Mount]
What=/var/lib/snapd/snaps/core_11993.snap
Where=/snap/core/11993
Type=fuse.snapfuse
Options=nodev,ro,x-gdu.hide,x-gvfs-hide,allow_other
LazyUnmount=yes

[Install]
WantedBy=multi-user.target

# /run/systemd/generator/snap-core-11993.mount.d/container.conf
[Mount]
Type=fuse.snapfuse
Options=nodev,ro,x-gdu.hide,x-gvfs-hide,allow_other
LazyUnmount=yes

@atesburak
Copy link
Contributor

Seems to be related to the user option storage in utab. See util-linux/util-linux#1583

@karelzak
Copy link

karelzak commented Feb 3, 2022

Looks like libmount has stripped some options, so it eiether has opinions on what the proper format is, or there's a bug in libmount.

@bboozzoo Yes, this is a libmount bug.

It keeps only one X/x-* option. It's already fixed by commit http://github.com/util-linux/util-linux/commit/d85f45d5ddb020b9858356b4c2c91d962ac7e6d7. This bugfix will be in v2.38.

@bboozzoo
Copy link
Collaborator

bboozzoo commented Feb 3, 2022

It keeps only one X/x-* option. It's already fixed by commit http://github.com/util-linux/util-linux/commit/d85f45d5ddb020b9858356b4c2c91d962ac7e6d7. This bugfix will be in v2.38.

@karelzak thank you for confirming and fixing it!

@atesburak
Copy link
Contributor

atesburak commented Feb 3, 2022

Looks like libmount has stripped some options, so it eiether has opinions on what the proper format is, or there's a bug in libmount.

@bboozzoo Yes, this is a libmount bug.

It keeps only one X/x-* option. It's already fixed by commit http://github.com/util-linux/util-linux/commit/d85f45d5ddb020b9858356b4c2c91d962ac7e6d7. This bugfix will be in v2.38.

Thanks for the update @karelzak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants