Skip to content

Expose MountedByOpenat2 as a public function so that k8s can consume#96

Closed
manugupt1 wants to merge 1 commit intomoby:masterfrom
manugupt1:master
Closed

Expose MountedByOpenat2 as a public function so that k8s can consume#96
manugupt1 wants to merge 1 commit intomoby:masterfrom
manugupt1:master

Conversation

@manugupt1
Copy link
Copy Markdown
Contributor

Expose MountedByOpenat2 as a public function so that k8s can consume

One of the alternatives suggested here is to expose MountedByOpenat2 as a public function
so that k8s can consume and rest of the downstream can also benefit from it.

kubernetes/kubernetes#105833 (comment)

cc @kolyshkin

@kolyshkin
Copy link
Copy Markdown
Collaborator

I think it's better to export something like 'MountedFast' which includes all the methods except for parsing mountinfo.

I'll create the PR.

@kolyshkin
Copy link
Copy Markdown
Collaborator

I think it's better to export something like 'MountedFast' which includes all the methods except for parsing mountinfo.

OK, this is problematic, because there's no way to communicate back to the caller if we're sure this is not a mount point.

Unless we do something like this:

func MountedFast(path string) (mounted, sure bool, err error)

when mounted == false, the caller needs to check sure and if it's false, proceed to mountinfo parsing.

@manugupt1
Copy link
Copy Markdown
Contributor Author

I think it's better to export something like 'MountedFast' which includes all the methods except for parsing mountinfo.

OK, this is problematic, because there's no way to communicate back to the caller if we're sure this is not a mount point.

Unless we do something like this:

func MountedFast(path string) (mounted, sure bool, err error)

That is something that will work to; my PR always falls back if the fast path cannot guarantee a mount-point.

manugupt1 pushed a commit to manugupt1/sys that referenced this pull request Dec 8, 2021
MountedFast is a method of detecting mount points really fast.
It works for all kinds of mounts (incl. bind mounts) but requires
a recent (v5.6+) Linux kernel. A mount-point check is guaranteed to
be a mount-point or not only when sure is true. When sure is false,
the caller needs to check for other methods (eg: parse /proc/mounts)
to successfully determine if it is a mount-point.

This has been motivated by
kubernetes/kubernetes#105833 (comment)
and
moby#96 (comment)
manugupt1 pushed a commit to manugupt1/sys that referenced this pull request Dec 8, 2021
MountedFast is a method of detecting mount points really fast.
It works for all kinds of mounts (incl. bind mounts) but requires
a recent (v5.6+) Linux kernel. A mount-point check is guaranteed to
be a mount-point or not only when sure is true. When sure is false,
the caller needs to check for other methods (eg: parse /proc/mounts)
to successfully determine if it is a mount-point.

This has been motivated by
kubernetes/kubernetes#105833 (comment)
and
moby#96 (comment)
manugupt1 pushed a commit to manugupt1/sys that referenced this pull request Dec 8, 2021
MountedFast is a method of detecting mount points really fast.
It works for all kinds of mounts (incl. bind mounts) but requires
a recent (v5.6+) Linux kernel. A mount-point check is guaranteed to
be a mount-point or not only when sure is true. When sure is false,
the caller needs to check for other methods (eg: parse /proc/mounts)
to successfully determine if it is a mount-point.

This has been motivated by
kubernetes/kubernetes#105833 (comment)
and
moby#96 (comment)
manugupt1 pushed a commit to manugupt1/sys that referenced this pull request Dec 8, 2021
MountedFast is a method of detecting mount points really fast.
It works for all kinds of mounts (incl. bind mounts) but requires
a recent (v5.6+) Linux kernel. A mount-point check is guaranteed to
be a mount-point or not only when sure is true. When sure is false,
the caller needs to check for other methods (eg: parse /proc/mounts)
to successfully determine if it is a mount-point.

This has been motivated by
kubernetes/kubernetes#105833 (comment)
and
moby#96 (comment)

Signed-off-by: Manu Gupta <[email protected]>
@manugupt1
Copy link
Copy Markdown
Contributor Author

Closing in favor of #97

@manugupt1 manugupt1 closed this Dec 8, 2021
@manugupt1 manugupt1 deleted the master branch March 7, 2022 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants