diff options
author | David Howells <dhowells@redhat.com> | 2019-05-20 08:48:46 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-09-02 11:43:54 +0100 |
commit | 8b6a666a97544bf307190a05947742b8357aa962 (patch) | |
tree | 16c344dabab751936bd81e720cc58620013976be /include/linux/key.h | |
parent | 23a289137ab82daeea826eeb9556c6f89b1fcd67 (diff) |
afs: Provide an RCU-capable key lookup
Provide an RCU-capable key lookup function. We don't want to call
afs_request_key() in RCU-mode pathwalk as request_key() might sleep, even if
we don't ask it to construct anything as it might find a key that is currently
undergoing construction.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'include/linux/key.h')
-rw-r--r-- | include/linux/key.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/key.h b/include/linux/key.h index 50028338a4cc..6cf8e71cf8b7 100644 --- a/include/linux/key.h +++ b/include/linux/key.h @@ -324,7 +324,7 @@ static inline struct key *request_key(struct key_type *type, } #ifdef CONFIG_NET -/* +/** * request_key_net - Request a key for a net namespace and wait for construction * @type: Type of key. * @description: The searchable description of the key. @@ -341,6 +341,18 @@ static inline struct key *request_key(struct key_type *type, */ #define request_key_net(type, description, net, callout_info) \ request_key_tag(type, description, net->key_domain, callout_info); + +/** + * request_key_net_rcu - Request a key for a net namespace under RCU conditions + * @type: Type of key. + * @description: The searchable description of the key. + * @net: The network namespace that is the key's domain of operation. + * + * As for request_key_rcu() except that only keys that operate the specified + * network namespace are used. + */ +#define request_key_net_rcu(type, description, net) \ + request_key_rcu(type, description, net->key_domain); #endif /* CONFIG_NET */ extern int wait_for_key_construction(struct key *key, bool intr); |