From 68c72b661f85a3562297cba42d2f599fc347207a Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 31 Jul 2012 14:40:41 -0400 Subject: [PATCH] LINUX: Always hold afs_xuser for unixuser read We were failing to hold the afs_xuser lock when we entered our unixuser traversal for the first time (when the given position is 0). This means we can release the lock without acquiring it, causing all kinds of weird behavior. Just always grab afs_xuser on entry. We could possibly do some tricks to avoid grabbing this lock until after we've printed the column headers, but it does not seem worth it. Reviewed-on: http://gerrit.openafs.org/7916 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 351d3b8a19314027b30cdc499ef48c95ba7903b6) Change-Id: I75e137e588fcbf973a5d564db3a077c4ec4f50e1 Reviewed-on: http://gerrit.openafs.org/8547 Reviewed-by: Ken Dreyer Tested-by: BuildBot Reviewed-by: Stephan Wiesand Tested-by: Stephan Wiesand Reviewed-by: Paul Smeddle --- src/afs/LINUX/osi_proc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/afs/LINUX/osi_proc.c b/src/afs/LINUX/osi_proc.c index 3f687f35b..974c0a771 100644 --- a/src/afs/LINUX/osi_proc.c +++ b/src/afs/LINUX/osi_proc.c @@ -138,12 +138,14 @@ uu_start(struct seq_file *m, loff_t *pos) loff_t n = 0; afs_int32 i; - if (!*pos) - return (void *)(1); - AFS_GLOCK(); ObtainReadLock(&afs_xuser); + if (!*pos) { + ret = (void *)(1); + goto done; + } + ret = NULL; for (i = 0; i < NUSERS; i++) { -- 2.39.5