svn commit: r288776 - stable/10/sys/cam/ctl
Alexander Motin
mav at FreeBSD.org
Mon Oct 5 10:42:59 UTC 2015
Author: mav
Date: Mon Oct 5 10:42:58 2015
New Revision: 288776
URL: https://svnweb.freebsd.org/changeset/base/288776
Log:
MFC r287986: Fix memory corruption when >128K transferred through HA link.
While there, do some cleaning.
Modified:
stable/10/sys/cam/ctl/ctl.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c Mon Oct 5 10:42:07 2015 (r288775)
+++ stable/10/sys/cam/ctl/ctl.c Mon Oct 5 10:42:58 2015 (r288776)
@@ -1082,7 +1082,7 @@ ctl_isc_event_handler(ctl_ha_channel cha
if (msg->dt.sg_sequence == 0) {
i = msg->dt.kern_sg_entries +
- io->scsiio.kern_data_len /
+ msg->dt.kern_data_len /
CTL_HA_DATAMOVE_SEGMENT + 1;
sgl = malloc(sizeof(*sgl) * i, M_CTL,
M_WAITOK | M_ZERO);
@@ -1118,11 +1118,8 @@ ctl_isc_event_handler(ctl_ha_channel cha
sgl[i].len = msg->dt.sg_list[j].len;
#if 0
- printf("%s: L: %p,%d -> %p,%d j=%d, i=%d\n",
- __func__,
- msg->dt.sg_list[j].addr,
- msg->dt.sg_list[j].len,
- sgl[i].addr, sgl[i].len, j, i);
+ printf("%s: DATAMOVE: %p,%lu j=%d, i=%d\n",
+ __func__, sgl[i].addr, sgl[i].len, j, i);
#endif
}
@@ -12539,11 +12536,8 @@ ctl_datamove_remote_dm_write_cb(union ct
{
int retval;
- retval = 0;
-
retval = ctl_datamove_remote_xfer(io, CTL_HA_DT_CMD_WRITE,
ctl_datamove_remote_write_cb);
-
return (retval);
}
@@ -12573,11 +12567,7 @@ ctl_datamove_remote_write(union ctl_io *
io->scsiio.be_move_done = ctl_datamove_remote_dm_write_cb;
fe_datamove = ctl_io_port(&io->io_hdr)->fe_datamove;
-
fe_datamove(io);
-
- return;
-
}
static int
@@ -12652,14 +12642,13 @@ ctl_datamove_remote_read_cb(struct ctl_h
/* XXX KDM add checks like the ones in ctl_datamove? */
fe_datamove = ctl_io_port(&io->io_hdr)->fe_datamove;
-
fe_datamove(io);
}
static int
ctl_datamove_remote_sgl_setup(union ctl_io *io)
{
- struct ctl_sg_entry *local_sglist, *remote_sglist;
+ struct ctl_sg_entry *local_sglist;
struct ctl_softc *softc;
uint32_t len_to_go;
int retval;
@@ -12668,7 +12657,6 @@ ctl_datamove_remote_sgl_setup(union ctl_
retval = 0;
softc = control_softc;
local_sglist = io->io_hdr.local_sglist;
- remote_sglist = io->io_hdr.remote_sglist;
len_to_go = io->scsiio.kern_data_len;
/*
@@ -12694,7 +12682,7 @@ ctl_datamove_remote_sgl_setup(union ctl_
printf("%s: kern_sg_entries = %d\n", __func__,
io->scsiio.kern_sg_entries);
for (i = 0; i < io->scsiio.kern_sg_entries; i++)
- printf("%s: sg[%d] = %p, %d\n", __func__, i,
+ printf("%s: sg[%d] = %p, %lu\n", __func__, i,
local_sglist[i].addr, local_sglist[i].len);
#endif
@@ -12812,7 +12800,7 @@ ctl_datamove_remote_xfer(union ctl_io *i
rq->callback = callback;
#if 0
- printf("%s: %s: local %#x remote %#x size %d\n", __func__,
+ printf("%s: %s: local %p remote %p size %d\n", __func__,
(command == CTL_HA_DT_CMD_WRITE) ? "WRITE" : "READ",
rq->local, rq->remote, rq->size);
#endif
@@ -12858,8 +12846,6 @@ ctl_datamove_remote_read(union ctl_io *i
io->io_hdr.remote_sglist = NULL;
io->io_hdr.local_sglist = NULL;
}
-
- return;
}
/*
More information about the svn-src-stable-10
mailing list