saltstack / saltstack/salt

[BUG] Forced remount because options changed when no options changed

Open
#65,865 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
A highstate forces a remount because of changed options even if no remount is necessary.

In our case it's because of the option noauto.

Setup
We use Salt-SSH to manage our Linode Ubuntu VMs.

  • VM running on a cloud service: Linode
  • onedir packaging: brew on OS X

Steps to Reproduce the behavior
Apply a highstate when the mount is already done

mount -l | grep redacted:

/dev/mapper/redacted on /mnt/storage type ext4 (rw,noatime,errors=remount-ro)

cat /proc/self/mountinfo | grep redacted:

440 30 253:0 / /mnt/storage rw,noatime shared:216 - ext4 /dev/mapper/redacted rw,errors=remount-ro

State to be applied:

redacted-mount:
  mount.mounted:
    - name: /mnt/storage
    - device: /dev/mapper/redacted
    - fstype: ext4
    - opts: errors=remount-ro,noauto,noatime
    - persist: False
    - mount: True
    - dump: 0
    - pass_num: 0

Expected behavior
Nothing should happen because no option has changed

Screenshots
salt-ssh redacted state.highstate test=True:

----------
          ID: redacted-mount
    Function: mount.mounted
        Name: /mnt/storage
      Result: None
     Comment: Remount would be forced because options (noauto) changed
     Started: 11:43:58.422813
    Duration: 7.405 ms
     Changes:   
----------

salt-ssh redacted state.highstate:

----------
          ID: redacted-mount
    Function: mount.mounted
        Name: /mnt/storage
      Result: True
     Comment: Target was already mounted
     Started: 11:50:45.518528
    Duration: 13.03 ms
     Changes:   
              ----------
              umount:
                  Forced remount because options (noauto) changed
----------

Versions Report

salt --versions-report

master:

Salt Version:
          Salt: 3006.1
 
Python Version:
        Python: 3.10.11 (main, May  5 2023, 02:37:04) [Clang 14.0.0 (clang-1400.0.29.202)]
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.0
     docker-py: Not Installed
         gitdb: 4.0.5
     gitpython: 3.1.30
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
        relenv: 0.12.3
         smmap: 3.0.2
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: darwin 22.6.0 
        locale: utf-8
       machine: x86_64
       release: 22.6.0
        system: Darwin
       version: 13.6.3 x86_64

Minion:

$ uname -a
Linux redacted 5.15.0-83-generic #92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Additional context
I've created this issue because all other related issues I've found are marked as stale and closed 🤷
Like https://github.com/saltstack/salt/issues/18630

Possible fix

Extending the fix from https://github.com/saltstack/salt/pull/19369/files with noauto should fix this particular issue.
Verified with a local adaption and applying salt-ssh -t redacted state.highstate test=True.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the mount.mounted state entry point and compare its option-change handling with the proposed fix in pull request 19369. Reproduce the behavior with the provided state and salt-ssh test=True command, then verify that the noauto option does not trigger a forced remount when the mount is already correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.