cred: add get_cred_rcu()
Sometimes we want to opportunistically get a ref to a cred in an rcu_read_lock protected section. get_task_cred() does this, and NFS does as similar thing with its own credential structures. To prepare for NFS converting to use 'struct cred' more uniformly, define get_cred_rcu(), and use it in get_task_cred(). Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:

committed by
Anna Schumaker

parent
d89b22d46a
commit
97d0fb239c
@@ -195,7 +195,7 @@ const struct cred *get_task_cred(struct task_struct *task)
|
||||
do {
|
||||
cred = __task_cred((task));
|
||||
BUG_ON(!cred);
|
||||
} while (!atomic_inc_not_zero(&((struct cred *)cred)->usage));
|
||||
} while (!get_cred_rcu(cred));
|
||||
|
||||
rcu_read_unlock();
|
||||
return cred;
|
||||
|
Reference in New Issue
Block a user