mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 11:13:50 +00:00
Don't trigger SYSERROR for optional mounts
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
36eaa69415
commit
1fc64d22ae
@ -1821,12 +1821,19 @@ int parse_mntopts(const char *mntopts, unsigned long *mntflags,
|
|||||||
|
|
||||||
static int mount_entry(const char *fsname, const char *target,
|
static int mount_entry(const char *fsname, const char *target,
|
||||||
const char *fstype, unsigned long mountflags,
|
const char *fstype, unsigned long mountflags,
|
||||||
const char *data)
|
const char *data, int optional)
|
||||||
{
|
{
|
||||||
if (mount(fsname, target, fstype, mountflags & ~MS_REMOUNT, data)) {
|
if (mount(fsname, target, fstype, mountflags & ~MS_REMOUNT, data)) {
|
||||||
|
if (optional) {
|
||||||
|
INFO("failed to mount '%s' on '%s' (optional): %s", fsname,
|
||||||
|
target, strerror(errno));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
SYSERROR("failed to mount '%s' on '%s'", fsname, target);
|
SYSERROR("failed to mount '%s' on '%s'", fsname, target);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((mountflags & MS_REMOUNT) || (mountflags & MS_BIND)) {
|
if ((mountflags & MS_REMOUNT) || (mountflags & MS_BIND)) {
|
||||||
|
|
||||||
@ -1835,11 +1842,18 @@ static int mount_entry(const char *fsname, const char *target,
|
|||||||
|
|
||||||
if (mount(fsname, target, fstype,
|
if (mount(fsname, target, fstype,
|
||||||
mountflags | MS_REMOUNT, data)) {
|
mountflags | MS_REMOUNT, data)) {
|
||||||
|
if (optional) {
|
||||||
|
INFO("failed to mount '%s' on '%s' (optional): %s",
|
||||||
|
fsname, target, strerror(errno));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
SYSERROR("failed to mount '%s' on '%s'",
|
SYSERROR("failed to mount '%s' on '%s'",
|
||||||
fsname, target);
|
fsname, target);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG("mounted '%s' on '%s', type '%s'", fsname, target, fstype);
|
DEBUG("mounted '%s' on '%s', type '%s'", fsname, target, fstype);
|
||||||
|
|
||||||
@ -1910,10 +1924,7 @@ static inline int mount_entry_on_systemfs(struct mntent *mntent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = mount_entry(mntent->mnt_fsname, mntent->mnt_dir,
|
ret = mount_entry(mntent->mnt_fsname, mntent->mnt_dir,
|
||||||
mntent->mnt_type, mntflags, mntdata);
|
mntent->mnt_type, mntflags, mntdata, optional);
|
||||||
|
|
||||||
if (optional)
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
free(pathdirname);
|
free(pathdirname);
|
||||||
free(mntdata);
|
free(mntdata);
|
||||||
@ -2000,13 +2011,10 @@ skipabs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = mount_entry(mntent->mnt_fsname, path, mntent->mnt_type,
|
ret = mount_entry(mntent->mnt_fsname, path, mntent->mnt_type,
|
||||||
mntflags, mntdata);
|
mntflags, mntdata, optional);
|
||||||
|
|
||||||
free(mntdata);
|
free(mntdata);
|
||||||
|
|
||||||
if (optional)
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(pathdirname);
|
free(pathdirname);
|
||||||
return ret;
|
return ret;
|
||||||
@ -2059,10 +2067,7 @@ static int mount_entry_on_relative_rootfs(struct mntent *mntent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = mount_entry(mntent->mnt_fsname, path, mntent->mnt_type,
|
ret = mount_entry(mntent->mnt_fsname, path, mntent->mnt_type,
|
||||||
mntflags, mntdata);
|
mntflags, mntdata, optional);
|
||||||
|
|
||||||
if (optional)
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
free(pathdirname);
|
free(pathdirname);
|
||||||
free(mntdata);
|
free(mntdata);
|
||||||
|
Loading…
Reference in New Issue
Block a user