Skip to content
This repository has been archived by the owner on Aug 6, 2020. It is now read-only.

umount: Don't use options from fstab on remount #22

Merged
merged 1 commit into from Aug 22, 2018

Conversation

aszlig
Copy link
Member

@aszlig aszlig commented Aug 21, 2018

This has been merged upstream at via pull request systemd#9886 and it fixes the systemd NixOS test (and of course also remounting of filesystems with application-specific mount options).

Text of the original pull request:

The fstab entry may contain comment/application-specific options, like for example x-systemd.automount or x-initrd.mount.

With the recent switch to libmount, the mount options during remount are now gathered via mnt_fs_get_options(), which merges the fstab options with the effective options in mountinfo.

Unfortunately if one of these application-specific options are set in fstab, the remount will fail with -EINVAL.

In systemd 238:

Remounting '/test-x-initrd-mount' read-only in with options 'errors=continue,user_xattr,acl'.

In systemd 239:

Remounting '/test-x-initrd-mount' read-only in with options 'errors=continue,user_xattr,acl,x-initrd.mount'.
Failed to remount '/test-x-initrd-mount' read-only: Invalid argument

So instead of using mnt_fs_get_options(), we're now using mnt_fs_get_fs_options(), which boils down to the same behaviour as we had in systemd 238, mainly reading just the file system specific options
from mountinfo.

This is a cherry-pick of the commit that landed in the upstream master branch.

Cc: @edolstra, @fpletz, @Mic92

The fstab entry may contain comment/application-specific options, like
for example x-systemd.automount or x-initrd.mount.

With the recent switch to libmount, the mount options during remount are
now gathered via mnt_fs_get_options(), which returns the merged fstab
options with the effective options in mountinfo.

Unfortunately if one of these application-specific options are set in
fstab, the remount will fail with -EINVAL.

In systemd 238:

  Remounting '/test-x-initrd-mount' read-only in with options
  'errors=continue,user_xattr,acl'.

In systemd 239:

  Remounting '/test-x-initrd-mount' read-only in with options
  'errors=continue,user_xattr,acl,x-initrd.mount'.
  Failed to remount '/test-x-initrd-mount' read-only: Invalid argument

So instead of using mnt_fs_get_options(), we're now using both
mnt_fs_get_fs_options() and mnt_fs_get_vfs_options() and merging the
results together so we don't get any non-relevant options from fstab.

Signed-off-by: aszlig <aszlig@nix.build>
(cherry picked from commit 66c91c3)
Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

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

makes sense.

@Mic92
Copy link
Member

Mic92 commented Aug 22, 2018

cc @globin

@Mic92
Copy link
Member

Mic92 commented Aug 22, 2018

Do we have other commits in master that are worth a backport, while we are at it?

@Mic92
Copy link
Member

Mic92 commented Aug 22, 2018

Here they reverted some kernel tunables for ECN: systemd@1e190df (originally systemd#9880)

There has been also an low-severity security issue with mount namespaces and fuse: systemd#9848 systemd#9852

I probably should backport those in different pull requests.

@globin globin merged commit 21efe60 into NixOS:nixos-v239 Aug 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants