summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctld/kernel.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-03-25 11:41:10 +0000
committertrasz <trasz@FreeBSD.org>2014-03-25 11:41:10 +0000
commit70b9e78e3d6f4047e7eb8fc921d56170e8916a09 (patch)
treec1d76feb07633b3d05a3fef8e7a59788d83b1732 /usr.sbin/ctld/kernel.c
parentf9534c51852e27b250b10411bae9be3a14effa34 (diff)
downloadFreeBSD-src-70b9e78e3d6f4047e7eb8fc921d56170e8916a09.zip
FreeBSD-src-70b9e78e3d6f4047e7eb8fc921d56170e8916a09.tar.gz
MFC r261765:
Improve error reporting. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/ctld/kernel.c')
-rw-r--r--usr.sbin/ctld/kernel.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c
index dc55594..c774aa3 100644
--- a/usr.sbin/ctld/kernel.c
+++ b/usr.sbin/ctld/kernel.c
@@ -678,8 +678,15 @@ kernel_listen(struct addrinfo *ai, bool iser)
req.data.listen.addr = ai->ai_addr;
req.data.listen.addrlen = ai->ai_addrlen;
- if (ioctl(ctl_fd, CTL_ISCSI, &req) == -1)
- log_warn("error issuing CTL_ISCSI_LISTEN ioctl");
+ if (ioctl(ctl_fd, CTL_ISCSI, &req) == -1) {
+ log_err(1, "error issuing CTL_ISCSI ioctl");
+ return;
+ }
+
+ if (req.status != CTL_ISCSI_OK) {
+ log_errx(1, "error returned from CTL iSCSI listen: %s",
+ req.error_str);
+ }
}
int
@@ -692,7 +699,13 @@ kernel_accept(void)
req.type = CTL_ISCSI_ACCEPT;
if (ioctl(ctl_fd, CTL_ISCSI, &req) == -1) {
- log_warn("error issuing CTL_ISCSI_LISTEN ioctl");
+ log_warn("error issuing CTL_ISCSI ioctl");
+ return (0);
+ }
+
+ if (req.status != CTL_ISCSI_OK) {
+ log_warnx("error returned from CTL iSCSI accept: %s",
+ req.error_str);
return (0);
}
@@ -712,13 +725,15 @@ kernel_send(struct pdu *pdu)
req.data.send.data_segment_len = pdu->pdu_data_len;
req.data.send.data_segment = pdu->pdu_data;
- if (ioctl(ctl_fd, CTL_ISCSI, &req) == -1)
+ if (ioctl(ctl_fd, CTL_ISCSI, &req) == -1) {
log_err(1, "error issuing CTL_ISCSI ioctl; "
"dropping connection");
+ }
- if (req.status != CTL_ISCSI_OK)
+ if (req.status != CTL_ISCSI_OK) {
log_errx(1, "error returned from CTL iSCSI send: "
"%s; dropping connection", req.error_str);
+ }
}
void
@@ -738,13 +753,15 @@ kernel_receive(struct pdu *pdu)
req.data.receive.data_segment_len = MAX_DATA_SEGMENT_LENGTH;
req.data.receive.data_segment = pdu->pdu_data;
- if (ioctl(ctl_fd, CTL_ISCSI, &req) == -1)
+ if (ioctl(ctl_fd, CTL_ISCSI, &req) == -1) {
log_err(1, "error issuing CTL_ISCSI ioctl; "
"dropping connection");
+ }
- if (req.status != CTL_ISCSI_OK)
+ if (req.status != CTL_ISCSI_OK) {
log_errx(1, "error returned from CTL iSCSI receive: "
"%s; dropping connection", req.error_str);
+ }
}
OpenPOWER on IntegriCloud