Commit 82c82291 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Andrei Vagin

uffd.c: error logging nitpicks

In cases errno is being set, we need to use pr_perror() to print it.

In cases errno is not set, we should use pr_err().

pr_perror() doesn't need a colon or a newline. pr_err() needs a newline.

Cc: Adrian Reber <areber@redhat.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
travis-ci: success for Assorted nitpicks
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 145c5094
...@@ -158,7 +158,7 @@ static int send_uffd(int sendfd, int pid) ...@@ -158,7 +158,7 @@ static int send_uffd(int sendfd, int pid)
* the FD for UFFD */ * the FD for UFFD */
pr_debug("Sending PID %d\n", pid); pr_debug("Sending PID %d\n", pid);
if (send(fd, &pid, sizeof(pid), 0) < 0) { if (send(fd, &pid, sizeof(pid), 0) < 0) {
pr_perror("PID sending error:"); pr_perror("PID sending error");
goto out; goto out;
} }
...@@ -169,7 +169,7 @@ static int send_uffd(int sendfd, int pid) ...@@ -169,7 +169,7 @@ static int send_uffd(int sendfd, int pid)
} }
if (send_fd(fd, NULL, 0, sendfd) < 0) { if (send_fd(fd, NULL, 0, sendfd) < 0) {
pr_perror("send_fd error:"); pr_err("send_fd error\n");
goto out; goto out;
} }
...@@ -336,7 +336,10 @@ static int ud_open(int client, struct lazy_pages_info **_lpi) ...@@ -336,7 +336,10 @@ static int ud_open(int client, struct lazy_pages_info **_lpi)
* the FD for UFFD */ * the FD for UFFD */
ret = recv(client, &lpi->pid, sizeof(lpi->pid), 0); ret = recv(client, &lpi->pid, sizeof(lpi->pid), 0);
if (ret != sizeof(lpi->pid)) { if (ret != sizeof(lpi->pid)) {
pr_perror("PID recv error:"); if (ret < 0)
pr_perror("PID recv error");
else
pr_err("PID recv: short read\n");
goto out; goto out;
} }
pr_debug("received PID: %d\n", lpi->pid); pr_debug("received PID: %d\n", lpi->pid);
...@@ -348,7 +351,7 @@ static int ud_open(int client, struct lazy_pages_info **_lpi) ...@@ -348,7 +351,7 @@ static int ud_open(int client, struct lazy_pages_info **_lpi)
lpi->uffd = recv_fd(client); lpi->uffd = recv_fd(client);
if (lpi->uffd < 0) { if (lpi->uffd < 0) {
pr_perror("recv_fd error:"); pr_err("recv_fd error\n");
goto out; goto out;
} }
pr_debug("lpi->uffd %d\n", lpi->uffd); pr_debug("lpi->uffd %d\n", lpi->uffd);
...@@ -690,7 +693,10 @@ static int handle_user_fault(struct lazy_pages_info *lpi, void *dest) ...@@ -690,7 +693,10 @@ static int handle_user_fault(struct lazy_pages_info *lpi, void *dest)
return 1; return 1;
if (ret != sizeof(msg)) { if (ret != sizeof(msg)) {
if (ret < 0)
pr_perror("Can't read userfaultfd message"); pr_perror("Can't read userfaultfd message");
else
pr_err("Can't read userfaultfd message: short read");
return -1; return -1;
} }
...@@ -871,7 +877,7 @@ static int prepare_uffds(int epollfd) ...@@ -871,7 +877,7 @@ static int prepare_uffds(int epollfd)
/* accept new client request */ /* accept new client request */
len = sizeof(struct sockaddr_un); len = sizeof(struct sockaddr_un);
if ((client = accept(listen, (struct sockaddr *) &saddr, &len)) < 0) { if ((client = accept(listen, (struct sockaddr *) &saddr, &len)) < 0) {
pr_perror("server_accept error: %d", client); pr_perror("server_accept error");
close(listen); close(listen);
return -1; return -1;
} }
......
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