mount -a always tries to mount CIFS share subdir despite being already mounted
Issue
Running mount -a several times causes mount attempts of CIFS shares subdir, included in fstab even though they are already mounted :
[root@rhel74-2 tmp]# grep cifs /etc/fstab
//rhel73/myshare/mydir /mnt/mnt2 cifs credentials=/etc/fstab.d/cifs/myshare,uid=1000,gid=1000,dir_mode=0777,file_mode=0666 0 0
[root@rhel74-2 tmp]# grep cifs /proc/mounts
//rhel73/myshare/mydir /mnt/mnt2 cifs rw,relatime,vers=1.0,cache=strict,username=roberto,domain=RHEL73,uid=1000,forceuid,gid=1000,forcegid,addr=172.23.1.225,file_mode=0666,dir_mode=0777,nounix,serverino,mapposix,rsize=61440,wsize=65536,echo_interval=60,actimeo=1 0 0
[root@rhel74-2 tmp]# df -k -t cifs
Filesystem 1K-blocks Used Available Use% Mounted on
//rhel73/myshare/mydir 8374272 7982708 391564 96% /mnt/mnt2
[root@rhel74-2 tmp]# mount -vvv -a
/ : ignored
/boot : already mounted
swap : ignored
/mnt : already mounted
mount.cifs kernel mount options: ip=172.23.1.225,unc=\\rhel73\myshare,dir_mode=0777,file_mode=0666,uid=1000,gid=1000,user=roberto,prefixpath=mydir,pass=********
mount error(16): Device or resource busy
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
[root@rhel74-2 tmp]# mount -vvv -a
/ : ignored
/boot : already mounted
swap : ignored
/mnt : already mounted
mount.cifs kernel mount options: ip=172.23.1.225,unc=\\rhel73\myshare,dir_mode=0777,file_mode=0666,uid=1000,gid=1000,user=roberto,prefixpath=mydir,pass=********
mount error(16): Device or resource busy
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
You may get EBUSY or a successful mount depending on CIFS client/server setup (in this latter case, a successful mount, /proc/mounts gets duplicate entries each time mount -a runs) but mount is always attempted.
Environment
- RHEL 7
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
