Subject: patch for kern/36331
To: None <tech-kern@netbsd.org>
From: Blair Sadewitz <blair.sadewitz@gmail.com>
List: tech-kern
Date: 05/21/2007 13:46:26
------=_Part_47314_11416816.1179769586269
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

This patch does what ad@ suggested on netbsd-bugs.
I have tested it with lfs and ffs, and I haven't had any more deadlocks thusfar.

--Blair

------=_Part_47314_11416816.1179769586269
Content-Type: application/octet-stream; name="ihashlocking.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="ihashlocking.patch"

SW5kZXg6IHN5cy91ZnMvZXh0MmZzL2V4dDJmc192ZnNvcHMuYwo9PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxl
OiAvY3Zzcm9vdC9zcmMvc3lzL3Vmcy9leHQyZnMvZXh0MmZzX3Zmc29wcy5jLHYKcmV0cmlldmlu
ZyByZXZpc2lvbiAxLjExMApkaWZmIC11IC1yMS4xMTAgZXh0MmZzX3Zmc29wcy5jCi0tLSBzeXMv
dWZzL2V4dDJmcy9leHQyZnNfdmZzb3BzLmMJMTIgTWFyIDIwMDcgMTg6MTg6MzcgLTAwMDAJMS4x
MTAKKysrIHN5cy91ZnMvZXh0MmZzL2V4dDJmc192ZnNvcHMuYwkyMSBNYXkgMjAwNyAxNjo0Nzo0
NiAtMDAwMApAQCAtOTM2LDcgKzkzNiw3IEBACiAKIAl1bXAgPSBWRlNUT1VGUyhtcCk7CiAJZGV2
ID0gdW1wLT51bV9kZXY7Ci0KK3JldHJ5OgogCWlmICgoKnZwcCA9IHVmc19paGFzaGdldChkZXYs
IGlubywgTEtfRVhDTFVTSVZFKSkgIT0gTlVMTCkKIAkJcmV0dXJuICgwKTsKIApAQCAtOTQ4LDEx
ICs5NDgsMTEgQEAKIAlpcCA9IHBvb2xfZ2V0KCZleHQyZnNfaW5vZGVfcG9vbCw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