Commit 9695c7057f4887ed54dc1e6c2ef22f72a2be1175

Authored by Stanislav Kinsbursky
Committed by J. Bruce Fields
1 parent 5e1533c788

SUNRPC: service request network namespace helper introduced

This is a cleanup patch - makes code looks simplier.
It replaces widely used rqstp->rq_xprt->xpt_net by introduced SVC_NET(rqstp).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

Showing 5 changed files with 9 additions and 7 deletions Side-by-side Diff

... ... @@ -331,7 +331,7 @@
331 331 struct nsm_handle *nsm = NULL;
332 332 struct sockaddr *src_sap = svc_daddr(rqstp);
333 333 size_t src_len = rqstp->rq_daddrlen;
334   - struct net *net = rqstp->rq_xprt->xpt_net;
  334 + struct net *net = SVC_NET(rqstp);
335 335 struct nlm_lookup_host_info ni = {
336 336 .server = 1,
337 337 .sap = svc_addr(rqstp),
fs/nfs/callback_xdr.c
... ... @@ -863,7 +863,7 @@
863 863 .drc_status = 0,
864 864 .clp = NULL,
865 865 .slotid = NFS4_NO_SLOT,
866   - .net = rqstp->rq_xprt->xpt_net,
  866 + .net = SVC_NET(rqstp),
867 867 };
868 868 unsigned int nops = 0;
869 869  
... ... @@ -879,7 +879,7 @@
879 879 return rpc_garbage_args;
880 880  
881 881 if (hdr_arg.minorversion == 0) {
882   - cps.clp = nfs4_find_client_ident(rqstp->rq_xprt->xpt_net, hdr_arg.cb_ident);
  882 + cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
883 883 if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
884 884 return rpc_drop_reply;
885 885 }
... ... @@ -929,7 +929,7 @@
929 929 rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
930 930 {
931 931 struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
932   - struct nfsd_net *nn = net_generic(rqstp->rq_xprt->xpt_net, nfsd_net_id);
  932 + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
933 933 struct cache_detail *cd = nn->svc_export_cache;
934 934  
935 935 if (rqstp->rq_client == NULL)
... ... @@ -960,7 +960,7 @@
960 960 rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
961 961 {
962 962 struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
963   - struct nfsd_net *nn = net_generic(rqstp->rq_xprt->xpt_net, nfsd_net_id);
  963 + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
964 964 struct cache_detail *cd = nn->svc_export_cache;
965 965  
966 966 if (rqstp->rq_client == NULL)
... ... @@ -546,7 +546,7 @@
546 546 .type = type,
547 547 };
548 548 int ret;
549   - struct nfsd_net *nn = net_generic(rqstp->rq_xprt->xpt_net, nfsd_net_id);
  549 + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
550 550  
551 551 if (namelen + 1 > sizeof(key.name))
552 552 return nfserr_badowner;
... ... @@ -571,7 +571,7 @@
571 571 .type = type,
572 572 };
573 573 int ret;
574   - struct nfsd_net *nn = net_generic(rqstp->rq_xprt->xpt_net, nfsd_net_id);
  574 + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
575 575  
576 576 strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
577 577 ret = idmap_lookup(rqstp, idtoname_lookup, &key, nn->idtoname_cache, &item);
include/linux/sunrpc/svc.h
... ... @@ -278,6 +278,8 @@
278 278 struct task_struct *rq_task; /* service thread */
279 279 };
280 280  
  281 +#define SVC_NET(svc_rqst) (svc_rqst->rq_xprt->xpt_net)
  282 +
281 283 /*
282 284 * Rigorous type checking on sockaddr type conversions
283 285 */