mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
mount-util: fix error code
If multiple service is starting simultaneously with a shared image,
then one of the service may fail to create a mount node:
systemd[695]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[696]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[695]: Failed to mount /usr/lib/os-release (type n/a) on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC ""): No such file or directory
systemd[696]: Failed to mount /usr/lib/os-release (type n/a) on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC ""): No such file or directory
systemd[695]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[696]: Failed to create destination mount point node '/run/systemd/unit-root/run/host/os-release': Operation not permitted
systemd[695]: Successfully mounted /usr/lib/os-release to /run/systemd/unit-root/run/host/os-release
The function apply_one_mount() in src/core/namespace.c gracefully
handles -EEXIST from make_mount_point_inode_from_path(), but it erroneously
returned -EPERM previously. This fixes the issue.
Fixes one of the issues in #24147, especially reported at
https://github.com/systemd/systemd/issues/24147#issuecomment-1236194671.
(cherry picked from commit b6ca2b281e
)
This commit is contained in:
parent
1b1ad8c79f
commit
24238be484
@ -1137,7 +1137,7 @@ int make_mount_point_inode_from_stat(const struct stat *st, const char *dest, mo
|
||||
if (S_ISDIR(st->st_mode))
|
||||
return mkdir_label(dest, mode);
|
||||
else
|
||||
return mknod(dest, S_IFREG|(mode & ~0111), 0);
|
||||
return RET_NERRNO(mknod(dest, S_IFREG|(mode & ~0111), 0));
|
||||
}
|
||||
|
||||
int make_mount_point_inode_from_path(const char *source, const char *dest, mode_t mode) {
|
||||
|
Loading…
Reference in New Issue
Block a user