Date: Thu, 19 Aug 2004 19:45:53 -0700 From: Sandy Rutherford <sandy@krvarr.bc.ca> To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: bin/69875: `mlxcontrol status <drivename>' hangs with Mylex DAC1100 RAID controller Message-ID: <16677.26081.228866.733818@szamoca.krvarr.bc.ca> In-Reply-To: <200408011340.i71DeJ8f015505@freefall.freebsd.org> References: <200408011339.i71DdPV8003732@szamoca.krvarr.bc.ca> <200408011340.i71DeJ8f015505@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Here is a patch for this problem report.
The bug is in the subr's `mlxd_foreach_ctrlr' and
`mlxd_find_ctrlr_search', both in interface.c. Both of these
subroutines use `ioctl(fd, MLX_NEXT_CHILD, &i)' to iterate over the
configured mlxd(4) devices. However, in FreeBSD 4.10-RELEASE, this
simply sets i to 0.
I have replaced this code with a simple-minded loop from i=0 to 63,
which is a large enough loop to find any devices on the RAID
controllers supported by mlxd(4). It is likely that there is a more
clever fix, but this does the job for me. If anybody has a better
fix, I would be happy to test it.
Attached is a patch file for /usr/src/usr.sbin/mlxcontrol/interface.c
in FreeBSD 4.10-RELEASE.
...Sandy
[-- Attachment #2 --]
*** interface.c.orig Fri Aug 6 03:39:24 2004
--- interface.c Fri Aug 6 04:06:55 2004
***************
*** 85,95 ****
if ((fd = open(ctrlrpath(unit), 0)) < 0)
return;
! for (i = -1; ;) {
/* Get the unit number of the next child device */
! if (ioctl(fd, MLX_NEXT_CHILD, &i) < 0)
! return;
!
/* check that we can open this unit */
if ((fd = open(drivepath(i), 0)) >= 0)
close(fd);
--- 85,97 ----
if ((fd = open(ctrlrpath(unit), 0)) < 0)
return;
! for (i = 0; i < 64 ; i++) {
/* Get the unit number of the next child device */
! /* Here, this always sets i to 0, instead of iterating over */
! /* devices. As A work-around, I have hard-coded a loop */
! /* from 0 to 64. ...sandy */
! /* if (ioctl(fd, MLX_NEXT_CHILD, &i) < 0) */
! /* return; */
/* check that we can open this unit */
if ((fd = open(drivepath(i), 0)) >= 0)
close(fd);
***************
*** 128,137 ****
/* Get the device */
if ((fd = open(ctrlrpath(unit), 0)) >= 0) {
! for (i = -1; ;) {
/* Get the unit number of the next child device */
! if (ioctl(fd, MLX_NEXT_CHILD, &i) < 0)
! break;
/* is this child the unit we want? */
if (i == mlxd_find_ctrlr_param.unit) {
--- 130,144 ----
/* Get the device */
if ((fd = open(ctrlrpath(unit), 0)) >= 0) {
! for (i = 0; i < 64 ; i++) {
! /* for (i = -1; ;){ */
/* Get the unit number of the next child device */
! /* This sets i to 0 and never returns -1. */
! /* Therefore, the for loop never completes. */
! /* As a work-around, I simply loop from from 0 to 64 */
! /* looking for controllers. ...sandy */
! /* if (ioctl(fd, MLX_NEXT_CHILD, &i) < 0) */
! /* break; */
/* is this child the unit we want? */
if (i == mlxd_find_ctrlr_param.unit) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16677.26081.228866.733818>
