On 05-May-2003 Petri Helenius wrote: > IŽve been bouncing this with Soren a few roundtrips and I thought IŽll ask a wider > audience since I could not locate the information who would be responsible for > grabbing Giant in this case, but it seems to be required to hold it when the thread > exits; (the panic occurs when ATA RAID rebuild thread completes) The kthread is supposed to acquire Giant before calling kthread_exit(). Actually, my guess is that the ar kthread needs to acquire Giant for the lifetime of the thread. I have an untested patch locally: Index: ata-raid.c =================================================================== RCS file: /usr/cvs/src/sys/dev/ata/ata-raid.c,v retrieving revision 1.64 diff -u -r1.64 ata-raid.c --- ata-raid.c 4 May 2003 16:17:54 -0000 1.64 +++ ata-raid.c 5 May 2003 18:15:35 -0000 _at__at_ -969,6 +969,7 _at__at_ int disk, s, count = 0, error = 0; caddr_t buffer; + mtx_lock(&Giant); if ((rdp->flags & (AR_F_READY|AR_F_DEGRADED)) != (AR_F_READY|AR_F_DEGRADED)) kthread_exit(EEXIST); > FreeBSD 5.0-CURRENT #3: Sat May 3 11:09:45 GMT 2003 > root_at_kompak.vuokselantie10.fi:/usr/src/sys/i386/compile/EMTEST > kompak# atacontrol status 0 > ar0: ATA RAID1 subdisks: ad4 ad6 status: REBUILDING 44% completed > kompak# panic: mutex Giant not owned at ../../../kern/kern_exit.c:122 > Debugger("panic") > Stopped at Debugger+0x54: xchgl %ebx,in_Debugger.0 > db> trace > Debugger(c038d044,c03eedc0,c038c78b,d26f4c54,1) at Debugger+0x54 > panic(c038c78b,c038c8c4,c038acdf,7a,104) at panic+0xab > _mtx_assert(c03ed140,1,c038acdf,7a,85) at _mtx_assert+0xec > exit1(c2a075f0,0,85,84,2) at exit1+0x33 > kthread_exit(0,1,1,0,0) at kthread_exit+0xb6 > ar_rebuild(c25e3000,d26f4d48,c038ad90,310,c2a075f0) at ar_rebuild+0x445 > fork_exit(c0161c40,c25e3000,d26f4d48) at fork_exit+0xc0 > fork_trampoline() at fork_trampoline+0x1a > --- trap 0x1, eip = 0, esp = 0xd26f4d7c, ebp = 0 --- > db> -- John Baldwin <jhb_at_FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/Received on Mon May 05 2003 - 11:01:52 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:06 UTC