Skip to content
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

Partially revert "mount: Check if src exists before mounted (#61752)" #68102

Closed
wants to merge 1 commit into from

Conversation

patrakov
Copy link

@patrakov patrakov commented Mar 8, 2020

This reverts part of commit 72023d7.

The immediate reason is that it breaks mounts where src is not a path.
Examples of such mounts are nfs, cifs, glusterfs, ceph, tmpfs,
overlayfs, and it is too hard to come with an exhaustive list,
especially if we take non-Linux systems into account.

Additionally, it did not really fix the issue (#59183) that it intended
to fix, because the mount could fail but leave a non-working fstab entry
for reasons other than non-existing src path.

SUMMARY

This was originally submitted as #65869, with some extra commits that attempt to re-fix #59183. However, that pull request was not properly reviewed in 2+ months, presumably because the additional commits are too complex. Therefore, I am resubmitting just the minimal fix that is hopefully easier to review.

Fixes: #65855
Fixes: #67588
Fixes: #67966

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

mount

ADDITIONAL INFORMATION

See #65544 and #65869.

This reverts part of commit 72023d7.

The immediate reason is that it breaks mounts where src is not a path.
Examples of such mounts are nfs, cifs, glusterfs, ceph, tmpfs,
overlayfs, and it is too hard to come with an exhaustive list,
especially if we take non-Linux systems into account.

Additionally, it did not really fix the issue (#59183) that it intended
to fix, because the mount could fail but leave a non-working fstab entry
for reasons other than non-existing src path.
@ansibot
Copy link
Contributor

ansibot commented Mar 8, 2020

cc @jtyr
click here for bot help

@ansibot ansibot added affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category labels Mar 8, 2020
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Mar 10, 2020
@bcoca
Copy link
Member

bcoca commented Mar 10, 2020

I would prefer the fix would add an aditional check not startswith('UUID=', 'LABEL=') and then keep the path.exists check for those cases

@bcoca bcoca added P3 Priority 3 - Approved, No Time Limitation and removed affects_2.10 This issue/PR affects Ansible v2.10 labels Mar 10, 2020
@patrakov
Copy link
Author

patrakov commented Mar 10, 2020

I am absolutely opposed to any additional checks. We have already tried that while discussing #65544 and failed. Martin initially missed CIFS. I missed the UUID and LABEL cases. You, in your own previous comment, missed PARTUUID. Then OpenBSD has special syntax (which looks like 55128c3700af5491.a) too, which is described in section "DUIDs and /etc/fstab" in the Absolute OpenBSD book. I am sure we miss many other cases.

Finally, missing src is not the only reason why a mount could fail. E.g., there could have been a wrong filesystem, or the kernel has not been compiled with support for the correct filesystem, or there are incorrect options, or ... Therefore, checking src does not, by itself, fix the bug (#59183) that it was meant to fix. Even if we do check src, we would need to write code that deals with any unexplained mount failures. And once we have this code (see #65869), checking src becomes unnecessary.

In summary, we should not go into the business of predicting whether the mount command will succeed. Just let it fail when it needs to fail and then deal with the consequences.

@patrakov
Copy link
Author

patrakov commented Mar 10, 2020

Also, why is it P3? It is a fix for a critical regression (cannot mount remote filesystems at all) in the mount module, but the regression is only in unreleased versions. So it should block release, so P2. One of the rationales for this merge request is exactly to revert the regression as soon as possible, because it is far worse than the bug that the commit 72023d7 tried to fix.

@patrakov
Copy link
Author

patrakov commented Mar 11, 2020

I would prefer the fix would add an aditional check not startswith('UUID=', 'LABEL=') and then keep the path.exists check for those cases

Done (as a new pull request, see #68155), but I would very much prefer this pull request (and ideally #65869) to be merged instead of that. That's also why a new pull request instead of amending this one.

@Akasurde
Copy link
Member

First of all, sorry for introducing the wrong fix. I agree with @patrakov, we should not predict anything about the mount and just remove this check once.

@patrakov
Copy link
Author

@Akasurde could you please review the proper fix (i.e. the attempt to remove created directories and restore the fstab if the mount fails) in #65869 ?

@Akasurde
Copy link
Member

@Akasurde could you please review the proper fix (i.e. the attempt to remove created directories and restore the fstab if the mount fails) in #65869 ?

Code LGTM, I will test and comment on #65869. I would see this PR getting merged first.

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Mar 19, 2020
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Mar 27, 2020
@ansibot ansibot added collection Related to Ansible Collections work collection:ansible.posix needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 24, 2020
@Akasurde
Copy link
Member

superseded by ansible-collections/ansible.posix#33

@Akasurde Akasurde closed this Jun 10, 2020
@Akasurde
Copy link
Member

@patrakov Thanks for the contribution.

@ansible ansible locked and limited conversation to collaborators Jul 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. collection:ansible.posix collection Related to Ansible Collections work has_issue module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. new_contributor This PR is the first contribution by a new community member. P3 Priority 3 - Approved, No Time Limitation small_patch stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. system System category
Projects
None yet
4 participants