svn commit: r261765 - head/usr.sbin/ctld
Edward Tomasz Napierala
trasz at FreeBSD.org
Tue Feb 11 11:35:27 UTC 2014
Author: trasz
Date: Tue Feb 11 11:35:26 2014
New Revision: 261765
URL: http://svnweb.freebsd.org/changeset/base/261765
Log:
Improve error reporting.
Sponsored by: The FreeBSD Foundation
Modified:
head/usr.sbin/ctld/kernel.c
Modified: head/usr.sbin/ctld/kernel.c
==============================================================================
--- head/usr.sbin/ctld/kernel.c Tue Feb 11 11:33:44 2014 (r261764)
+++ head/usr.sbin/ctld/kernel.c Tue Feb 11 11:35:26 2014 (r261765)
@@ -678,8 +678,15 @@ kernel_listen(struct addrinfo *ai, bool
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);
+ }
}
More information about the svn-src-all
mailing list