Commit 6c064b66 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

unix: Print reverted dir info if only directory provided

Otherwise there is an imbalance in logs with number of
"Reverted working dir" message

 | (00.018604)     36: unix: Connected 0x11ceff -> 0x11cf00 (0x11cf00) flags 0
 | (00.018644)     36: unix: Reverted working dir
 | (00.018652)     36: unix: Connected 0x11cefd -> 0x11cefe (0x11cefe) flags 0
 | (00.018665)     36: unix: Reverted working dir
 | (00.018688)     36: unix: Reverted working dir
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 1fa59fa3
......@@ -1130,7 +1130,7 @@ static int restore_sk_common(int fd, struct unix_sk_info *ui)
return 0;
}
static int revert_unix_sk_cwd(int *prev_cwd_fd, int *root_fd, int *ns_fd)
static int revert_unix_sk_cwd(struct unix_sk_info *ui, int *prev_cwd_fd, int *root_fd, int *ns_fd)
{
int ret = 0;
......@@ -1145,7 +1145,7 @@ static int revert_unix_sk_cwd(int *prev_cwd_fd, int *root_fd, int *ns_fd)
if (prev_cwd_fd && *prev_cwd_fd >= 0) {
if (fchdir(*prev_cwd_fd))
pr_perror("Can't revert working dir");
else
else if (ui->name_dir)
pr_debug("Reverted working dir\n");
close(*prev_cwd_fd);
*prev_cwd_fd = -1;
......@@ -1279,12 +1279,12 @@ static int post_open_standalone(struct file_desc *d, int fd)
sizeof(addr.sun_family) +
peer->ue->name.len) < 0) {
pr_perror("Can't connect %#x socket", ui->ue->ino);
revert_unix_sk_cwd(&cwd_fd, &root_fd, &ns_fd);
revert_unix_sk_cwd(peer, &cwd_fd, &root_fd, &ns_fd);
return -1;
}
ui->is_connected = true;
revert_unix_sk_cwd(&cwd_fd, &root_fd, &ns_fd);
revert_unix_sk_cwd(peer, &cwd_fd, &root_fd, &ns_fd);
restore_queue:
if (peer->queuer == ui &&
......@@ -1414,7 +1414,7 @@ static int bind_unix_sk(int sk, struct unix_sk_info *ui)
exit_code = 0;
done:
revert_unix_sk_cwd(&cwd_fd, &root_fd, &ns_fd);
revert_unix_sk_cwd(ui, &cwd_fd, &root_fd, &ns_fd);
return exit_code;
}
......@@ -1756,7 +1756,7 @@ static void unlink_stale(struct unix_sk_info *ui)
ui->name ? (ui->name[0] ? ui->name : &ui->name[1]) : "-",
ui->name_dir ? ui->name_dir : "-");
}
revert_unix_sk_cwd(&cwd_fd, &root_fd, &ns_fd);
revert_unix_sk_cwd(ui, &cwd_fd, &root_fd, &ns_fd);
}
static void try_resolve_unix_peer(struct unix_sk_info *ui);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment