From sandy@krvarr.bc.ca Sun Aug 1 13:39:37 2004 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6632516A4CE for ; Sun, 1 Aug 2004 13:39:37 +0000 (GMT) Received: from szamoca.krvarr.bc.ca (s142-179-111-232.bc.hsia.telus.net [142.179.111.232]) by mx1.FreeBSD.org (Postfix) with ESMTP id 58F6243D2F for ; Sun, 1 Aug 2004 13:39:31 +0000 (GMT) (envelope-from sandy@krvarr.bc.ca) Received: from szamoca.krvarr.bc.ca (localhost [127.0.0.1]) by szamoca.krvarr.bc.ca (8.12.11/8.12.6) with ESMTP id i71DdPJc003733; Sun, 1 Aug 2004 06:39:25 -0700 (PDT) Received: (from sandy@localhost) by szamoca.krvarr.bc.ca (8.12.11/8.12.11/Submit) id i71DdPV8003732; Sun, 1 Aug 2004 06:39:25 -0700 (PDT) (envelope-from sandy) Message-Id: <200408011339.i71DdPV8003732@szamoca.krvarr.bc.ca> Date: Sun, 1 Aug 2004 06:39:25 -0700 (PDT) From: Sandy Rutherford Reply-To: Sandy Rutherford To: FreeBSD-gnats-submit@freebsd.org Cc: Sandy Rutherford Subject: `mlxcontrol status ' hangs with Mylex DAC1100 RAID controller X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 69875 >Category: bin >Synopsis: [patch] mlxcontrol(8): `mlxcontrol status ' hangs with Mylex DAC1100 RAID controller >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Aug 01 13:40:19 GMT 2004 >Closed-Date: >Last-Modified: Sat Jun 03 07:31:32 GMT 2006 >Originator: Sandy Rutherford >Release: FreeBSD 4.10-RELEASE i386 >Organization: >Environment: Problem occurs under FreeBSD 4.10-RELEASE i386 with a Mylex DAC1100PVX, 3 channels, firmware 5.08-W-48, RAID controller. The controller is configured with 3 system disks: mlxd0 - JBOD array mlxd1 - JBOD array mlxd2 - RAID 1 array System: FreeBSD szamoca.krvarr.bc.ca 4.10-RELEASE FreeBSD 4.10-RELEASE #22: Sat Jul 31 23:26:04 PDT 2004 >Description: Executing (as root) any one of `mlxcontrol status mlxd0', `mlxcontrol status mlxd1', or `mlxcontrol status mlxd2' hangs with no output. Executing the above commands with the "-v" flag also hangs with no output. Executing `mlxcontrol status -v' produces the following output and then hangs: --------------------------------------------------------------- [root@szamoca:29] mlxcontrol status -v mlx0: DAC1100PVX, 3 channels, firmware 5.08-W-48, 32MB RAM Hardware ID 0x03020320 Firmware ID 0x30570805 Configured/Actual channels 3/3 Max Targets 16 Max Tags 236 Max System Drives 32 Max Arms 8 Max Spans 4 DRAM/cache/flash/NVRAM size 33554432/31481856/1048576/32768 DRAM type 10 Clock Speed 40ns Hardware Speed 360ns Max Commands 128 Max SG Entries 33 Max DP 472 Max IOD 1024 Max Comb 256 Latency 12s SCSI Timeout 18s Min Free Lines 72 Rate Constant 50 MAXBLK 128 Blocking Factor 1 sectors Cache Line Size 16 blocks SCSI Capability 40MHz, 16 bit Firmware Build Number 0 Fault Management Type 0 disk0001 (online) 'FUJITSU ' 'MAB3091S SUN9.0G' '1705' 8637MB fast20 wide sync tag-enabled disk0002 (online) 'FUJITSU ' 'MAE3182LP ' '0112' 17430MB fast20 wide sync tag-enabled disk0003 (online) 'FUJITSU ' 'MAB3091S SUN9.0G' '1705' 8637MB fast20 wide sync tag-enabled disk0004 (online) 'SEAGATE ' 'SX118202LS ' 'B808' 17366MB fast20 wide sync tag-enabled --------------------------------------------------------------------- Running `truss mlxcontrol status mlxd0' produces the following output: --------------------------------------------------------------------- mmap(0x0,2048,0x3,0x1000,-1,0x0) = 671490048 (0x28062000) munmap(0x28062000,0x800) = 0 (0x0) __sysctl(0xbfbff740,0x2,0x28060f88,0xbfbff73c,0x0,0x0) = 0 (0x0) mmap(0x0,32768,0x3,0x1002,-1,0x0) = 671490048 (0x28062000) geteuid() = 0 (0x0) getuid() = 0 (0x0) getegid() = 0 (0x0) getgid() = 0 (0x0) open("/etc/libmap.conf",0x0,0666) = 3 (0x3) fstat(3,0xbfbfeec8) = 0 (0x0) munmap(0x28066000,0x4000) = 0 (0x0) mmap(0x0,53248,0x3,0x1002,-1,0x0) = 671506432 (0x28066000) read(0x3,0x28067000,0x4000) = 579 (0x243) read(0x3,0x28067000,0x4000) = 0 (0x0) close(3) = 0 (0x0) open("/var/run/ld-elf.so.hints",0x0,00) = 3 (0x3) read(0x3,0xbfbff720,0x80) = 128 (0x80) lseek(3,0x80,0) = 128 (0x80) read(0x3,0x2806d000,0x4d) = 77 (0x4d) close(3) = 0 (0x0) access("/usr/lib/libc.so.4",0) = 0 (0x0) open("/usr/lib/libc.so.4",0x0,05001222053) = 3 (0x3) fstat(3,0xbfbff768) = 0 (0x0) read(0x3,0xbfbfe738,0x1000) = 4096 (0x1000) mmap(0x0,626688,0x5,0x20002,3,0x0) = 671559680 (0x28073000) mprotect(0x280f4000,0x1000,0x7) = 0 (0x0) mprotect(0x280f4000,0x1000,0x5) = 0 (0x0) mmap(0x280f5000,20480,0x3,0x12,3,0x81000) = 672092160 (0x280f5000) mmap(0x280fa000,73728,0x3,0x1012,-1,0x0) = 672112640 (0x280fa000) close(3) = 0 (0x0) mmap(0x0,248,0x3,0x1000,-1,0x0) = 672186368 (0x2810c000) munmap(0x2810c000,0xf8) = 0 (0x0) mmap(0x0,13360,0x3,0x1000,-1,0x0) = 672186368 (0x2810c000) munmap(0x2810c000,0x3430) = 0 (0x0) sigaction(SIGILL,0xbfbff7c0,0xbfbff7a8) = 0 (0x0) sigprocmask(0x1,0x0,0x28060ebc) = 0 (0x0) sigaction(SIGILL,0xbfbff7a8,0x0) = 0 (0x0) sigprocmask(0x1,0x28060e80,0xbfbff7e8) = 0 (0x0) sigprocmask(0x3,0x28060e90,0x0) = 0 (0x0) open("/dev/mlx0",0x0,05001165773) = 3 (0x3) close(3) = 0 (0x0) open("/dev/mlx0",0x0,05001162605) = 3 (0x3) ioctl(3,0xc0044d00,0xbfbff73c) = 0 (0x0) ioctl(3,0xc0044d07,0xbfbff73c) = 0 (0x0) ioctl(3,0xc0044d00,0xbfbff73c) = 0 (0x0) ioctl(3,0xc0044d07,0xbfbff73c) = 0 (0x0) ioctl(3,0xc0044d00,0xbfbff73c) = 0 (0x0) ioctl(3,0xc0044d07,0xbfbff73c) = 0 (0x0) ioctl(3,0xc0044d00,0xbfbff73c) = 0 (0x0) ioctl(3,0xc0044d07,0xbfbff73c) = 0 (0x0) ioctl(3,0xc0044d00,0xbfbff73c) = 0 (0x0) ioctl(3,0xc0044d07,0xbfbff73c) = 0 (0x0) ... this last line repeats ad-infinitum... ---------------------------------------------------------------------------- >How-To-Repeat: Simply execute mlxcontrol. The problem appears 100% of the time. >Fix: None known. >Release-Note: >Audit-Trail: Adding to audit trail from misfiled PR pending/70068: I have tracked this problem down to the function `mlxd_find_ctrlr_search' in /usr/src/usr.sbin/mlxcontrol/interface.c. In the for loop in this function, the call to ioctl(2) always sets i to 0 and never returns -1. Therefore, this loop never completes. Presumably, the problem arose with recent changes in the behaviour of ioctl(2)? I don't understand how ioctl(2) works in FreeBSD well enough to fix this. However, if I come up with a patch, I'll submit it. ...Sandy From: Sandy Rutherford To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org Cc: Subject: Re: bin/69875: `mlxcontrol status ' hangs with Mylex DAC1100 RAID controller Date: Thu, 19 Aug 2004 19:45:53 -0700 --DqtoqZrip3 Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit 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 --DqtoqZrip3 Content-Type: application/octet-stream Content-Description: Context diff for /usr/src/usr/sbin/mlxcontrol/interface.c Content-Disposition: attachment; filename="interface.c.diff" Content-Transfer-Encoding: base64 KioqIGludGVyZmFjZS5jLm9yaWcJRnJpIEF1ZyAgNiAwMzozOToyNCAyMDA0Ci0tLSBpbnRlcmZh Y2UuYwlGcmkgQXVnICA2IDA0OjA2OjU1IDIwMDQKKioqKioqKioqKioqKioqCioqKiA4NSw5NSAq KioqCiAgICAgIGlmICgoZmQgPSBvcGVuKGN0cmxycGF0aCh1bml0KSwgMCkpIDwgMCkKICAJcmV0 dXJuOwogICAgICAKISAgICAgZm9yIChpID0gLTE7IDspIHsKICAJLyogR2V0IHRoZSB1bml0IG51 bWJlciBvZiB0aGUgbmV4dCBjaGlsZCBkZXZpY2UgKi8KISAJaWYgKGlvY3RsKGZkLCBNTFhfTkVY VF9DSElMRCwgJmkpIDwgMCkKISAJICAgIHJldHVybjsKISAJCiAgCS8qIGNoZWNrIHRoYXQgd2Ug Y2FuIG9wZW4gdGhpcyB1bml0ICovCiAgCWlmICgoZmQgPSBvcGVuKGRyaXZlcGF0aChpKSwgMCkp ID49IDApCiAgCSAgICBjbG9zZShmZCk7Ci0tLSA4NSw5NyAtLS0tCiAgICAgIGlmICgoZmQgPSBv cGVuKGN0cmxycGF0aCh1bml0KSwgMCkpIDwgMCkKICAJcmV0dXJuOwogICAgICAKISAgICAgZm9y IChpID0gMDsgaSA8IDY0IDsgaSsrKSB7CiAgCS8qIEdldCB0aGUgdW5pdCBudW1iZXIgb2YgdGhl IG5leHQgY2hpbGQgZGV2aWNlICovCiEgICAgICAgICAvKiBIZXJlLCB0aGlzIGFsd2F5cyBzZXRz IGkgdG8gMCwgaW5zdGVhZCBvZiBpdGVyYXRpbmcgb3ZlciAqLwohICAgICAgICAgLyogZGV2aWNl cy4gIEFzIEEgd29yay1hcm91bmQsIEkgaGF2ZSBoYXJkLWNvZGVkIGEgbG9vcCAgICAgKi8KISAg ICAgICAgIC8qIGZyb20gMCB0byA2NC4gIC4uLnNhbmR5ICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICovCiEgCS8qIGlmIChpb2N0bChmZCwgTUxYX05FWFRfQ0hJTEQsICZpKSA8IDAp ICAqLwohIAkvKiAgcmV0dXJuOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KICAJ LyogY2hlY2sgdGhhdCB3ZSBjYW4gb3BlbiB0aGlzIHVuaXQgKi8KICAJaWYgKChmZCA9IG9wZW4o ZHJpdmVwYXRoKGkpLCAwKSkgPj0gMCkKICAJICAgIGNsb3NlKGZkKTsKKioqKioqKioqKioqKioq CioqKiAxMjgsMTM3ICoqKioKICAgICAgCiAgICAgIC8qIEdldCB0aGUgZGV2aWNlICovCiAgICAg IGlmICgoZmQgPSBvcGVuKGN0cmxycGF0aCh1bml0KSwgMCkpID49IDApIHsKISAJZm9yIChpID0g LTE7IDspIHsKICAJICAgIC8qIEdldCB0aGUgdW5pdCBudW1iZXIgb2YgdGhlIG5leHQgY2hpbGQg ZGV2aWNlICovCiEgCSAgICBpZiAoaW9jdGwoZmQsIE1MWF9ORVhUX0NISUxELCAmaSkgPCAwKQoh IAkJYnJlYWs7CiAgCiAgCSAgICAvKiBpcyB0aGlzIGNoaWxkIHRoZSB1bml0IHdlIHdhbnQ/ICov CiAgCSAgICBpZiAoaSA9PSBtbHhkX2ZpbmRfY3RybHJfcGFyYW0udW5pdCkgewotLS0gMTMwLDE0 NCAtLS0tCiAgICAgIAogICAgICAvKiBHZXQgdGhlIGRldmljZSAqLwogICAgICBpZiAoKGZkID0g b3BlbihjdHJscnBhdGgodW5pdCksIDApKSA+PSAwKSB7CiEgCWZvciAoaSA9IDA7IGkgPCA2NCA7 IGkrKykgewohICAgICAvKiAgZm9yIChpID0gLTE7IDspeyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgKi8KICAJICAgIC8qIEdldCB0aGUgdW5pdCBudW1iZXIgb2YgdGhl IG5leHQgY2hpbGQgZGV2aWNlICovCiEgICAgICAgICAgICAgLyogVGhpcyBzZXRzIGkgdG8gMCBh bmQgbmV2ZXIgcmV0dXJucyAtMS4gICAgICAgICAgICAqLwohICAgICAgICAgICAgIC8qIFRoZXJl Zm9yZSwgdGhlIGZvciBsb29wIG5ldmVyIGNvbXBsZXRlcy4gICAgICAgICAgKi8KISAJICAgIC8q IEFzIGEgd29yay1hcm91bmQsIEkgc2ltcGx5IGxvb3AgZnJvbSBmcm9tIDAgdG8gNjQgKi8KISAJ ICAgIC8qIGxvb2tpbmcgZm9yIGNvbnRyb2xsZXJzLiAuLi5zYW5keSAgICAgICAgICAgICAgICAg Ki8KISAJICAvKiBpZiAoaW9jdGwoZmQsIE1MWF9ORVhUX0NISUxELCAmaSkgPCAwKSAgICAgICAg ICAgICAgKi8KISAJICAvKglicmVhazsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgKi8KICAKICAJICAgIC8qIGlzIHRoaXMgY2hpbGQgdGhlIHVuaXQgd2Ugd2FudD8g Ki8KICAJICAgIGlmIChpID09IG1seGRfZmluZF9jdHJscl9wYXJhbS51bml0KSB7Cg== --DqtoqZrip3-- >Unformatted: