[OpenAFS-devel] openafs: afs global lock not held [KEYRING]
chas williams - CONTRACTOR
chas@cmf.nrl.navy.mil
Fri, 09 Mar 2007 14:38:07 -0500
In message <20070309183018.GB1649@poobah.Stanford.EDU>,Miles Davis writes:
>kernel BUG at /var/tmp/openafs-1.4.2/src/libafs/MODLOAD-2.6.19-1.2895.fc6-SP/a
>fs_lock.c:133!
...
>Call Trace:
> [<f0d02ba6>] afs_FindUser+0x31/0xa2 [openafs]
> [<f0d2f21f>] afs_pag_destroy+0x10/0x2d [openafs]
> [<c04c46db>] key_cleanup+0xb7/0xd0
> [<c04368c7>] run_workqueue+0x97/0xdd
> [<c0437284>] worker_thread+0xd9/0x10d
> [<c0439810>] kthread+0xc0/0xec
> [<c0404c03>] kernel_thread_helper+0x7/0x10
my fault. try this patch. afs_pag_destroy() should take AFS_GLOCK.
since ->destroy can happen during key_put() and we use key_put()
under AFS_GLOCK, we need to check to see if we already hold glock.
Index: src/afs/LINUX/osi_groups.c
===================================================================
--- src/afs/LINUX/osi_groups.c (revision 103)
+++ src/afs/LINUX/osi_groups.c (working copy)
@@ -560,13 +560,18 @@
{
afs_uint32 pag = key->payload.value;
struct unixuser *pu;
+ int locked = ISAFS_GLOCK();
+ if (!locked)
+ AFS_GLOCK();
pu = afs_FindUser(pag, -1, READ_LOCK);
if (pu) {
pu->ct.EndTimestamp = 0;
pu->tokenTime = 0;
afs_PutUser(pu, READ_LOCK);
}
+ if (!locked)
+ AFS_GUNLOCK();
}
struct key_type key_type_afs_pag =