mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 05:27:44 +00:00
pioctl: limit fruitless token searches
getNthCell searches the afs_users table for the nth token set belonging to a given user. However, it is impossible for a user to have more than one token set per cell. If the caller specifies a number greater than the total number of cells this cache manager knows about, we know the search will be fruitless. Instead, return early in this case, avoiding both the lock and the search. Change-Id: I509408d9aaa8f511813c4d82c121e199121bb8f3 Reviewed-on: https://gerrit.openafs.org/13597 Tested-by: BuildBot <buildbot@rampaginggeek.com> Tested-by: Mark Vitale <mvitale@sinenomine.net> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
parent
8d2306e1da
commit
fc7e1700fe
@ -2274,6 +2274,9 @@ getNthCell(afs_int32 uid, afs_int32 iterator) {
|
||||
int i;
|
||||
struct unixuser *tu = NULL;
|
||||
|
||||
if (iterator > afs_cellindex)
|
||||
return NULL; /* no point in looking */
|
||||
|
||||
i = UHash(uid);
|
||||
ObtainReadLock(&afs_xuser);
|
||||
for (tu = afs_users[i]; tu; tu = tu->next) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user