-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
an already mounted bind mount get wrong opts in fstab #39292
Comments
@disaster123 for the initial mount did you have all of those options set? I wonder if its grabbing the options you already had set? |
@Ch3LL no i did not. But yes it seems it grabs all those options from mount or /proc/mounts - but this is wrong. I see two reasons why this is wrong. 1.) For bind mounts /proc/mounts contains afterwards also the options of the mounpoint behind the mount point but they should never be part of the bind mount itself. |
@disaster123 thanks for clarifying that. Yeah agreed we definitely want to only set what you have specified. I haven't been able to replicate this using the following test case:
Do you know what your original mount command was. In terms of a fix for you I think the part of the code we want to focus in is https://github.com/saltstack/salt/blob/v2016.11.2/salt/states/mount.py#L211 Looks like its running If you run that command on your initial mount before running the state file what does it return? |
To me it looks different than yours. Here's the output:
|
@Ch3LL hope this helps. If you need more information. Please ask. |
@disaster123 thanks for including all the information that really helped. Looks like indeed it is including the options on the pre-mount. I think in my test case I was looking for the extra opts you were getting, but i'm not using xfs. So thanks for helping out with that.
The point of the code I pointed to earlier is indeed where it takes the current options and appends whats in the state. I think a good approach would be to add an argument that does not do this. I did not see an argument like that in the code base. So I'll approve this as a feature request. As a side note about |
@Ch3LL thanks for your further testing and reply. If this is a feature request how to solve this for 2016? The current state does not work for me. It includes wrong options i do not need nor want for bind. |
@Ch3LL any news? I still don't how how to fix this for 2016.11? |
It seems this was written with intended behavior so I added as a feature request to add a new argument to not add current options if its already mounted. If its a feature it would not be added to 2016.11 but to develop and then branched off into the next feature release. If this was intended behavior we could not change the default behavior in a bug fix release. As a workaround does it work if you unmount before mounting using mount.unounted? |
Any news on this? If the bind mount is not mounted and not in /etc/fstab, mount.mounted works great. However, if it is already mounted before (even via the very state), it gets remounted and all the superopts appended to the line in /etc/fstab. On subsequent state runs, there will be no change. I can see from states/mount.py how this is intended behaviour, but it's pretty much not what I'd want. I now have "relatime,rw,inode64,seclabel,bind,noquota,attr2" in fstab, of which "bind" is the only option that should be there. I simply do not want the superopts to make it into fstab. |
+1 for 2016.11 |
@mstarostik no updates on this right now. We are willing to accept PRs ping @garethgreenaway looks like you have done some work in this code. Any chance you have time to look at this? |
@Ch3LL need to review this issue closer but I believe it should be addressed by a PR I made to develop a few months back that will be available in the oxygen release. |
uh, oh d@mn, looks like a lineinfile is required in my formula, to workaround this |
can you clarify what you are running into @hoonetorg are you using the oxygen release that @garethgreenaway mentioned this might be fixed in? |
The code is still there in 2019.2:
Whats the reason behind it? It makes absolutely no sense to copy the options from the real fs for a bind mount. |
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. |
no this issue is still present |
Thank you for updating this issue. It is no longer marked as stale. |
@disaster123 if we take this on to do it would be in a newer release, AFAIK. I can take this up as ensuring clarification on that front, but wanting to make sure I am being transparent and clear with you. Assigning myself to investigate. |
@sagetherage Why? This is def. a bug not a feature. It makes absolutley no sense. Can you point to a usecase? |
@disaster123 I am merely the messenger, so bare with me as I attempt to get more information and attempt to move this along. |
OK thx please tell me how i can help |
seems my initial investigation that this was intended behavior is incorrect, i'll change to a bug issue thanks. |
Hi,
if a bind mount is already mounted it get's the wrong options in fstab.
Description of Issue/Question
state file:
resulting fstab entry:
grep home/tmp /etc/fstab
expected entry would be:
/home/tmp /home/tmp none bind,nodev,noexec,nosuid,rw 0 0
this only happens if i did
mount -o bind,nodev,noexec,nosuid,rw /home/tmp /home/tmp
before running salt. The other options i see are options "copied" from the root fs.
Versions Report
Salt Version:
Salt: 2016.11.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.2
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
System Versions:
dist: debian 8.6
machine: x86_64
release: 4.4.26+76-ph
system: Linux
version: debian 8.6
The text was updated successfully, but these errors were encountered: