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

sunrpc: Add net to pure API calls

There are two calls that operate on ip_map_cache and are
directly called from the nfsd code. Other places will be
handled in a different way.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Pavel Emelyanov and committed by
J. Bruce Fields
352114f3 3be4479f

+15 -13
+1 -1
fs/nfsd/export.c
··· 1593 1593 /* Insert client into hashtable. */ 1594 1594 for (i = 0; i < ncp->cl_naddr; i++) { 1595 1595 ipv6_addr_set_v4mapped(ncp->cl_addrlist[i].s_addr, &addr6); 1596 - auth_unix_add_addr(&addr6, dom); 1596 + auth_unix_add_addr(&init_net, &addr6, dom); 1597 1597 } 1598 1598 auth_unix_forget_old(dom); 1599 1599 auth_domain_put(dom);
+2 -2
fs/nfsd/nfsctl.c
··· 416 416 417 417 ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); 418 418 419 - clp = auth_unix_lookup(&in6); 419 + clp = auth_unix_lookup(&init_net, &in6); 420 420 if (!clp) 421 421 err = -EPERM; 422 422 else { ··· 479 479 480 480 ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); 481 481 482 - clp = auth_unix_lookup(&in6); 482 + clp = auth_unix_lookup(&init_net, &in6); 483 483 if (!clp) 484 484 err = -EPERM; 485 485 else {
+2 -2
include/linux/sunrpc/svcauth.h
··· 126 126 127 127 extern struct auth_domain *unix_domain_find(char *name); 128 128 extern void auth_domain_put(struct auth_domain *item); 129 - extern int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom); 129 + extern int auth_unix_add_addr(struct net *net, struct in6_addr *addr, struct auth_domain *dom); 130 130 extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new); 131 131 extern struct auth_domain *auth_domain_find(char *name); 132 - extern struct auth_domain *auth_unix_lookup(struct in6_addr *addr); 132 + extern struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr); 133 133 extern int auth_unix_forget_old(struct auth_domain *dom); 134 134 extern void svcauth_unix_purge(void); 135 135 extern void svcauth_unix_info_release(struct svc_xprt *xpt);
+10 -8
net/sunrpc/svcauth_unix.c
··· 327 327 return NULL; 328 328 } 329 329 330 - static inline struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr) 330 + static inline struct ip_map *ip_map_lookup(struct net *net, char *class, 331 + struct in6_addr *addr) 331 332 { 332 333 return __ip_map_lookup(&ip_map_cache, class, addr); 333 334 } ··· 361 360 return 0; 362 361 } 363 362 364 - static inline int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry) 363 + static inline int ip_map_update(struct net *net, struct ip_map *ipm, 364 + struct unix_domain *udom, time_t expiry) 365 365 { 366 366 return __ip_map_update(&ip_map_cache, ipm, udom, expiry); 367 367 } 368 368 369 - int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom) 369 + int auth_unix_add_addr(struct net *net, struct in6_addr *addr, struct auth_domain *dom) 370 370 { 371 371 struct unix_domain *udom; 372 372 struct ip_map *ipmp; ··· 375 373 if (dom->flavour != &svcauth_unix) 376 374 return -EINVAL; 377 375 udom = container_of(dom, struct unix_domain, h); 378 - ipmp = ip_map_lookup("nfsd", addr); 376 + ipmp = ip_map_lookup(net, "nfsd", addr); 379 377 380 378 if (ipmp) 381 - return ip_map_update(ipmp, udom, NEVER); 379 + return ip_map_update(net, ipmp, udom, NEVER); 382 380 else 383 381 return -ENOMEM; 384 382 } ··· 396 394 } 397 395 EXPORT_SYMBOL_GPL(auth_unix_forget_old); 398 396 399 - struct auth_domain *auth_unix_lookup(struct in6_addr *addr) 397 + struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr) 400 398 { 401 399 struct ip_map *ipm; 402 400 struct auth_domain *rv; 403 401 404 - ipm = ip_map_lookup("nfsd", addr); 402 + ipm = ip_map_lookup(net, "nfsd", addr); 405 403 406 404 if (!ipm) 407 405 return NULL; ··· 727 725 728 726 ipm = ip_map_cached_get(xprt); 729 727 if (ipm == NULL) 730 - ipm = ip_map_lookup(rqstp->rq_server->sv_program->pg_class, 728 + ipm = ip_map_lookup(&init_net, rqstp->rq_server->sv_program->pg_class, 731 729 &sin6->sin6_addr); 732 730 733 731 if (ipm == NULL)