diff --git a/lustre/kernel_patches/patches/dynamic-locks-2.4.24.patch b/lustre/kernel_patches/patches/dynamic-locks-2.4.24.patch index 0a3cf5a4bdaf6460c7ceaebcd821d3887349b734..4c729214f9c239b05c7bb83ac660999b79f10b5a 100644 --- a/lustre/kernel_patches/patches/dynamic-locks-2.4.24.patch +++ b/lustre/kernel_patches/patches/dynamic-locks-2.4.24.patch @@ -6,8 +6,8 @@ Index: linux-2.4.24/include/linux/dynlocks.h =================================================================== --- linux-2.4.24.orig/include/linux/dynlocks.h 2003-01-30 13:24:37.000000000 +0300 -+++ linux-2.4.24/include/linux/dynlocks.h 2004-07-15 18:32:18.000000000 +0400 -@@ -0,0 +1,41 @@ ++++ linux-2.4.24/include/linux/dynlocks.h 2004-07-16 10:25:15.000000000 +0400 +@@ -0,0 +1,45 @@ +#ifndef _LINUX_DYNLOCKS_H +#define _LINUX_DYNLOCKS_H + @@ -17,6 +17,8 @@ Index: linux-2.4.24/include/linux/dynlocks.h +#define DYNLOCK_MAGIC 0xd19a10c +#define DYNLOCK_MAGIC2 0xd1956ee + ++struct dynlock; ++ +struct dynlock_member { + unsigned dl_magic; + struct list_head dl_list; @@ -26,6 +28,7 @@ Index: linux-2.4.24/include/linux/dynlocks.h + int dl_writers; + int dl_pid; /* holder of the lock */ + wait_queue_head_t dl_wait; ++ struct dynlock *dl_head; +}; + +/* @@ -40,6 +43,7 @@ Index: linux-2.4.24/include/linux/dynlocks.h + unsigned dl_magic; + struct list_head dl_list; + spinlock_t dl_list_lock; ++ struct dynlock * dl_back; +}; + +void dynlock_init(struct dynlock *dl); @@ -52,8 +56,8 @@ Index: linux-2.4.24/include/linux/dynlocks.h Index: linux-2.4.24/lib/dynlocks.c =================================================================== --- linux-2.4.24.orig/lib/dynlocks.c 2003-01-30 13:24:37.000000000 +0300 -+++ linux-2.4.24/lib/dynlocks.c 2004-07-15 18:42:10.000000000 +0400 -@@ -0,0 +1,187 @@ ++++ linux-2.4.24/lib/dynlocks.c 2004-07-16 11:53:38.000000000 +0400 +@@ -0,0 +1,199 @@ +/* + * Dynamic Locks + * @@ -79,6 +83,7 @@ Index: linux-2.4.24/lib/dynlocks.c + spin_lock_init(&dl->dl_list_lock); + INIT_LIST_HEAD(&dl->dl_list); + dl->dl_magic = DYNLOCK_LIST_MAGIC; ++ dl->dl_back = dl; +} + +/* @@ -96,9 +101,15 @@ Index: linux-2.4.24/lib/dynlocks.c + struct dynlock_member *nhl = NULL; + struct dynlock_member *hl; + struct list_head *cur; ++ int num = 0; + + BUG_ON(dl == NULL); -+ BUG_ON(dl->dl_magic != DYNLOCK_LIST_MAGIC); ++ if (dl->dl_magic != DYNLOCK_LIST_MAGIC) { ++ printk("corrupted dynlock head 0x%p: magic 0x%x (!=0x%x)\n", ++ dl, dl->dl_magic, DYNLOCK_LIST_MAGIC); ++ BUG(); ++ } ++ BUG_ON(dl->dl_back != dl); +repeat: + /* find requested lock in lockspace */ + spin_lock(&dl->dl_list_lock); @@ -108,13 +119,14 @@ Index: linux-2.4.24/lib/dynlocks.c + BUG_ON(cur->next == NULL); + BUG_ON(cur->prev == NULL); + hl = list_entry(cur, struct dynlock_member, dl_list); -+ if (hl->dl_magic != DYNLOCK_MAGIC) { -+ printk("corrupted lock 0x%p: magic 0x%x (!=0x%x)\n", -+ hl, hl->dl_magic, DYNLOCK_MAGIC); ++ if (hl->dl_magic != DYNLOCK_MAGIC || hl->dl_head != dl) { ++ printk("corrupted lock 0x%p/%d: magic 0x%x (!=0x%x)\n", ++ hl, num, hl->dl_magic, DYNLOCK_MAGIC); + printk(" value 0x%lx, %d readers, %d writers, pid %d, %d refs\n", + hl->dl_value, hl->dl_readers, hl->dl_writers, + hl->dl_pid, hl->dl_refcount); -+ BUG_ON(1); ++ printk(" head 0x%p\n", hl->dl_head); ++ BUG(); + } + if (hl->dl_value == value) { + /* lock is found */ @@ -129,6 +141,7 @@ Index: linux-2.4.24/lib/dynlocks.c + hl->dl_refcount++; + goto found; + } ++ num++; + } + /* lock not found */ + if (nhl) { @@ -149,6 +162,7 @@ Index: linux-2.4.24/lib/dynlocks.c + nhl->dl_readers = 0; + nhl->dl_writers = 0; + nhl->dl_magic = DYNLOCK_MAGIC; ++ nhl->dl_head = dl; + init_waitqueue_head(&nhl->dl_wait); + + /* while lock is being allocated, someone else may allocate it @@ -201,13 +215,15 @@ Index: linux-2.4.24/lib/dynlocks.c + BUG_ON(dl == NULL); + BUG_ON(hl == NULL); + BUG_ON(dl->dl_magic != DYNLOCK_LIST_MAGIC); -+ if (hl->dl_magic != DYNLOCK_MAGIC) { ++ BUG_ON(dl->dl_back != dl); ++ if (hl->dl_magic != DYNLOCK_MAGIC || hl->dl_head != dl) { + printk("corrupted lock 0x%p: magic 0x%x (!=0x%x)\n", + hl, hl->dl_magic, DYNLOCK_MAGIC); + printk(" value 0x%lx, %d readers, %d writers, pid %d, %d refs\n", + hl->dl_value, hl->dl_readers, hl->dl_writers, + hl->dl_pid, hl->dl_refcount); -+ BUG_ON(1); ++ printk(" head 0x%p\n", hl->dl_head); ++ BUG(); + } + BUG_ON(current->pid != hl->dl_pid); +