pioctl: limit fruitless token searches 97/13597/2
authorMark Vitale <mvitale@sinenomine.net>
Thu, 23 May 2019 02:52:10 +0000 (22:52 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 7 Jun 2019 15:02:42 +0000 (11:02 -0400)
commitfc7e1700fe84f623fb9163466d24226df00b1a2c
tree8b06eac47a1b2f551824142c9d8d28d5bd14e07c
parent8d2306e1dae84af9ccbadd2518beaf8543d4413b
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>
src/afs/afs_pioctl.c