Skip to content

Don't require mount point for a non-directory to be a regular file - #409

Merged
cgwalters merged 1 commit into
containers:masterfrom
smcv:mount-onto-socket
Jun 10, 2021
Merged

cgwalters merged 1 commit into
containers:masterfrom
smcv:mount-onto-socket

Conversation

@smcv

@smcv smcv commented Mar 11, 2021

Copy link
Copy Markdown
Collaborator

Previously, mounting a socket over the top of an existing socket
would fail, because create_file() opens it with creat():

$ test -e /run/systemd/resolve/io.systemd.Resolve && echo exists
exists
$ bwrap \
  --bind / / \
  --bind /run/systemd/resolve/io.systemd.Resolve \
         /run/systemd/resolve/io.systemd.Resolve \
  /bin/true
bwrap: Can't create file at /run/systemd/resolve/io.systemd.Resolve: No such device or address

Tolerate the file existing as any type that we will be able to mount
a non-directory onto.

@smcv
smcv force-pushed the mount-onto-socket branch from 34ce658 to 8666a64 Compare April 7, 2021 11:51
@smcv
smcv force-pushed the mount-onto-socket branch 2 times, most recently from ea8ebef to afbc0d2 Compare April 19, 2021 09:39
@smcv

smcv commented Apr 19, 2021

Copy link
Copy Markdown
Collaborator Author

Now with a unit test.

Previously, mounting a socket over the top of an existing socket
would fail, because create_file() opens it with creat():

    $ test -e /run/systemd/resolve/io.systemd.Resolve && echo exists
    exists
    $ bwrap \
      --bind / / \
      --bind /run/systemd/resolve/io.systemd.Resolve \
             /run/systemd/resolve/io.systemd.Resolve \
      /bin/true
    bwrap: Can't create file at /run/systemd/resolve/io.systemd.Resolve: No such device or address

Tolerate the file existing as any type that we will be able to mount
a non-directory onto.

Signed-off-by: Simon McVittie <[email protected]>
@smcv
smcv force-pushed the mount-onto-socket branch from afbc0d2 to a00f39f Compare May 14, 2021 11:23
@smcv
smcv requested review from alexlarsson and cgwalters June 10, 2021 08:41
@cgwalters
cgwalters merged commit 7d4f226 into containers:master Jun 10, 2021
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