salt icon indicating copy to clipboard operation
salt copied to clipboard

mount.mounted does not completely unmount NFS mounts when options change

Open wwentland opened this issue 11 years ago • 12 comments

As mentioned in #18474 mount.mounted needs to unmount NFS mounts and then mount them again if their mount options change. This requires NFS to be special cased as it behaves differently than other filesystems in that regard.

In particular the following code requires some tweaks to allow for a complete "mount cycle":

       if opts:                                                             
                mount_invisible_options = ['defaults', 'comment', 'nobootwait', 'reconnect', 'delay_connect']
                for opt in opts:                                                 
                    comment_option = opt.split('=')[0]                           
                    if comment_option == 'comment':                              
                        opt = comment_option                                     
                    if opt not in active[real_name]['opts'] and opt not in mount_invisible_options:
                        if __opts__['test']:                                     
                            ret['result'] = None                                 
                            ret['comment'] = "Remount would be forced because options changed"
                            return ret                                           
                        else:                                                    
                            ret['changes']['umount'] = "Forced remount because " \
                                                        + "options changed"      
                            remount_result = __salt__['mount.remount'](real_name, device, mkmnt=mkmnt, fstype=fstype, opts=opts)
                            ret['result'] = remount_result

Here an additional check for the actual filesystem needs to be performed before remount_result = __salt__['mount.remount'](...) to use mount.unmount and mount.mount in lieu of mount.remount if NFS specific options changed.

wwentland avatar Dec 11 '14 11:12 wwentland

Thanks for the report @babilen.

@garethgreenaway - I think you've been doing the most work with mount lately. Just wanted to ping you here in case you wanted to check this one out, too. If not, we can take a look as well.

rallytime avatar Dec 11 '14 16:12 rallytime

Once I get the other mount issue resolved I should be ale to take a look at this one.

garethgreenaway avatar Dec 12 '14 05:12 garethgreenaway

Hope to have a pull request for this sometime tomorrow.

garethgreenaway avatar Dec 13 '14 05:12 garethgreenaway

Awesome! Thanks @garethgreenaway!

rallytime avatar Dec 13 '14 17:12 rallytime

Hi, it seems that this problems is not fixed yet. Perhaps you can done a lazy unmount for NFS mountpoints ?

# lsb_release -d
Description:    Debian GNU/Linux 8.2 (jessie)
# salt-call --version
salt-call 2015.5.3 (Lithium)
# salt-call state.highstate --state-output=changes
...
----------
          ID: /data/storage
    Function: mount.mounted
      Result: False
     Comment: Unable to unmount /data/storage: umount.nfs: /data/storage: device is busy.
     Started: 11:02:54.681981
    Duration: 99.953 ms
     Changes:
              ----------
              umount:
                  Forced unmount and mount because options (async) changed
...

Reiner030 avatar Oct 09 '15 11:10 Reiner030

+1 for fixing this, still seeing this issue with 2016.3.5+ds-1 Debian, Jessie

ksmitdevops avatar Mar 27 '17 18:03 ksmitdevops

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Sep 28 '18 19:09 stale[bot]

Nice how prooved bugs are not fixed for over three years and stale bot automatically closes them "silently" ... This problem occurs also for all FUSE based filesystems because they can't be remounted and is still a problem as far I know.

Reiner030 avatar Oct 07 '18 10:10 Reiner030

Stalebot is closing the issue because there hasn't been any additional comments. Issues can always be reopened :smile: if you can provide some more specifics about how the state module fails on fuse based file systems, I can take a look.

garethgreenaway avatar Oct 07 '18 15:10 garethgreenaway

Thank you for updating this issue. It is no longer marked as stale.

stale[bot] avatar Oct 07 '18 15:10 stale[bot]

Bump ^ We need more information on how this is failing on fuse systems

Ch3LL avatar Aug 03 '23 19:08 Ch3LL

Bump ^ We need more information on how this is failing on fuse systems

yes, reading this thread could help ;-)

As I wrote ... let me check ... 8 years ago there is the problem that FUSE has only 2 possible tasks.

  • mount
  • unmount

so your module which does a "mount -r" must fail... In this case it could be a nice option to do on FUSE mount points which can be recognized as FUSE based mount points instead an "unmount -l ... && mount ... "

Quick research shows e.g. here similar answers / no "-r" mount option for FUSE mounts: https://www.kernel.org/doc/html/next/filesystems/fuse.html https://fuse-devel.narkive.com/z81wTi5H/lazy-unmount

Reiner030 avatar Aug 03 '23 19:08 Reiner030