Messages in this thread Patch in this message | | | Date | Mon, 11 Jan 1999 17:09:22 +0100 (CET) | From | Patrik Rak <> | Subject | [PATCH] fix for locks.h example |
| |
Hi!
I can see that the file include/asm-i386/locks.h is not currently used in the kernel. I assume that it is kept in there just as an example for implementing spinlocks. However, it contains two bugs which the patch below fixes.
--- include/asm-i386/locks.h Sat Nov 29 19:33:21 1997 +++ include/asm-i386/locks.h.new Mon Jan 11 13:25:18 1999 @@ -62,7 +62,7 @@ not be safe this way */ if(!--sp->users) { - lock_clear_bit(0,&sp->lock);sp->cpu= NO_PROC_ID; + sp->cpu=NO_PROC_ID;lock_clear_bit(0,&sp->lock); return 1; } return 0; @@ -102,15 +102,17 @@ extern __inline__ void spinunlock(struct spinlock *sp) { + int pri; if(current->lock_order!=sp->priority) panic("lock release order violation %s (%d)\n", sp->name, current->lock_order); + pri=sp->oldpri; if(prim_spin_unlock(sp)) { /* * Update the debugging lock priority chain. We dumped * our last right to the lock. */ - current->lock_order=sp->oldpri; + current->lock_order=pri; } } Patrik
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |