mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 23:35:21 +00:00
unix: Don't drop whole socket with unlinked path
When we can't stat socket name with ENOENT errno this means, that the socket is bound and unlinked. Don't drop the whole socket info, just treat it as nameless. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
19
sk-unix.c
19
sk-unix.c
@@ -402,6 +402,7 @@ static int unix_collect_one(const struct unix_diag_msg *m,
|
|||||||
struct unix_diag_vfs *uv;
|
struct unix_diag_vfs *uv;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char rpath[PATH_MAX];
|
char rpath[PATH_MAX];
|
||||||
|
bool drop_path = false;
|
||||||
|
|
||||||
if (name[0] != '/') {
|
if (name[0] != '/') {
|
||||||
pr_warn("Relative bind path '%s' "
|
pr_warn("Relative bind path '%s' "
|
||||||
@@ -418,12 +419,16 @@ static int unix_collect_one(const struct unix_diag_msg *m,
|
|||||||
uv = RTA_DATA(tb[UNIX_DIAG_VFS]);
|
uv = RTA_DATA(tb[UNIX_DIAG_VFS]);
|
||||||
snprintf(rpath, sizeof(rpath), ".%s", name);
|
snprintf(rpath, sizeof(rpath), ".%s", name);
|
||||||
if (fstatat(mntns_root, rpath, &st, 0)) {
|
if (fstatat(mntns_root, rpath, &st, 0)) {
|
||||||
pr_warn("Can't stat socket %#x(%s), skipping: %m (err %d)\n",
|
if (errno != ENOENT) {
|
||||||
m->udiag_ino, rpath, errno);
|
pr_warn("Can't stat socket %#x(%s), skipping: %m (err %d)\n",
|
||||||
goto skip;
|
m->udiag_ino, rpath, errno);
|
||||||
}
|
goto skip;
|
||||||
|
}
|
||||||
|
|
||||||
if ((st.st_ino != uv->udiag_vfs_ino) ||
|
pr_info("unix: Dropping path %s for unlinked sk %#x\n",
|
||||||
|
name, m->udiag_ino);
|
||||||
|
drop_path = true;
|
||||||
|
} else if ((st.st_ino != uv->udiag_vfs_ino) ||
|
||||||
!phys_stat_dev_match(st.st_dev, uv->udiag_vfs_dev, name)) {
|
!phys_stat_dev_match(st.st_dev, uv->udiag_vfs_dev, name)) {
|
||||||
pr_info("unix: Dropping path %s for "
|
pr_info("unix: Dropping path %s for "
|
||||||
"unlinked bound "
|
"unlinked bound "
|
||||||
@@ -433,6 +438,10 @@ static int unix_collect_one(const struct unix_diag_msg *m,
|
|||||||
(int)st.st_ino,
|
(int)st.st_ino,
|
||||||
(int)uv->udiag_vfs_dev,
|
(int)uv->udiag_vfs_dev,
|
||||||
(int)uv->udiag_vfs_ino);
|
(int)uv->udiag_vfs_ino);
|
||||||
|
drop_path = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drop_path) {
|
||||||
/*
|
/*
|
||||||
* When a socket is bound to unlinked file, we
|
* When a socket is bound to unlinked file, we
|
||||||
* just drop his name, since no one will access
|
* just drop his name, since no one will access
|
||||||
|
Reference in New Issue
Block a user