Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SUNRPC: Add a server-side API for retrieving an RPC's pseudoflavor

NFSD will use this new API to determine whether nfsd_splice_read is
safe to use. This avoids the need to add a dependency to NFSD for
CONFIG_SUNRPC_GSS.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+28 -1
+6 -1
include/linux/sunrpc/svcauth.h
··· 131 131 * This call releases a domain. 132 132 * 133 133 * set_client() 134 - * Givens a pending request (struct svc_rqst), finds and assigns 134 + * Given a pending request (struct svc_rqst), finds and assigns 135 135 * an appropriate 'auth_domain' as the client. 136 + * 137 + * pseudoflavor() 138 + * Returns RPC_AUTH pseudoflavor in use by @rqstp. 136 139 */ 137 140 struct auth_ops { 138 141 char * name; ··· 146 143 int (*release)(struct svc_rqst *rqstp); 147 144 void (*domain_release)(struct auth_domain *dom); 148 145 enum svc_auth_status (*set_client)(struct svc_rqst *rqstp); 146 + rpc_authflavor_t (*pseudoflavor)(struct svc_rqst *rqstp); 149 147 }; 150 148 151 149 struct svc_xprt; 152 150 153 151 extern enum svc_auth_status svc_authenticate(struct svc_rqst *rqstp); 152 + extern rpc_authflavor_t svc_auth_flavor(struct svc_rqst *rqstp); 154 153 extern int svc_authorise(struct svc_rqst *rqstp); 155 154 extern enum svc_auth_status svc_set_client(struct svc_rqst *rqstp); 156 155 extern int svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops);
+6
net/sunrpc/auth_gss/svcauth_gss.c
··· 2014 2014 call_rcu(&dom->rcu_head, svcauth_gss_domain_release_rcu); 2015 2015 } 2016 2016 2017 + static rpc_authflavor_t svcauth_gss_pseudoflavor(struct svc_rqst *rqstp) 2018 + { 2019 + return svcauth_gss_flavor(rqstp->rq_gssclient); 2020 + } 2021 + 2017 2022 static struct auth_ops svcauthops_gss = { 2018 2023 .name = "rpcsec_gss", 2019 2024 .owner = THIS_MODULE, ··· 2027 2022 .release = svcauth_gss_release, 2028 2023 .domain_release = svcauth_gss_domain_release, 2029 2024 .set_client = svcauth_gss_set_client, 2025 + .pseudoflavor = svcauth_gss_pseudoflavor, 2030 2026 }; 2031 2027 2032 2028 static int rsi_cache_create_net(struct net *net)
+16
net/sunrpc/svcauth.c
··· 160 160 } 161 161 EXPORT_SYMBOL_GPL(svc_auth_unregister); 162 162 163 + /** 164 + * svc_auth_flavor - return RPC transaction's RPC_AUTH flavor 165 + * @rqstp: RPC transaction context 166 + * 167 + * Returns an RPC flavor or GSS pseudoflavor. 168 + */ 169 + rpc_authflavor_t svc_auth_flavor(struct svc_rqst *rqstp) 170 + { 171 + struct auth_ops *aops = rqstp->rq_authop; 172 + 173 + if (!aops->pseudoflavor) 174 + return aops->flavour; 175 + return aops->pseudoflavor(rqstp); 176 + } 177 + EXPORT_SYMBOL_GPL(svc_auth_flavor); 178 + 163 179 /************************************************** 164 180 * 'auth_domains' are stored in a hash table indexed by name. 165 181 * When the last reference to an 'auth_domain' is dropped,