提交 c212cecf 编写于 作者: S Stanislav Kinsbursky 提交者: J. Bruce Fields

nfsd: make nfs4_client network namespace dependent

And use it's net where possible.
Signed-off-by: NStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
上级 7f2210fa
...@@ -663,7 +663,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c ...@@ -663,7 +663,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
.to_retries = 0, .to_retries = 0,
}; };
struct rpc_create_args args = { struct rpc_create_args args = {
.net = &init_net, .net = clp->net,
.address = (struct sockaddr *) &conn->cb_addr, .address = (struct sockaddr *) &conn->cb_addr,
.addrsize = conn->cb_addrlen, .addrsize = conn->cb_addrlen,
.saddress = (struct sockaddr *) &conn->cb_saddr, .saddress = (struct sockaddr *) &conn->cb_saddr,
......
...@@ -859,8 +859,7 @@ nfsd4_cld_create(struct nfs4_client *clp) ...@@ -859,8 +859,7 @@ nfsd4_cld_create(struct nfs4_client *clp)
{ {
int ret; int ret;
struct cld_upcall *cup; struct cld_upcall *cup;
/* FIXME: determine net from clp */ struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id);
struct cld_net *cn = nn->cld_net; struct cld_net *cn = nn->cld_net;
/* Don't upcall if it's already stored */ /* Don't upcall if it's already stored */
...@@ -897,8 +896,7 @@ nfsd4_cld_remove(struct nfs4_client *clp) ...@@ -897,8 +896,7 @@ nfsd4_cld_remove(struct nfs4_client *clp)
{ {
int ret; int ret;
struct cld_upcall *cup; struct cld_upcall *cup;
/* FIXME: determine net from clp */ struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id);
struct cld_net *cn = nn->cld_net; struct cld_net *cn = nn->cld_net;
/* Don't upcall if it's already removed */ /* Don't upcall if it's already removed */
...@@ -935,8 +933,7 @@ nfsd4_cld_check(struct nfs4_client *clp) ...@@ -935,8 +933,7 @@ nfsd4_cld_check(struct nfs4_client *clp)
{ {
int ret; int ret;
struct cld_upcall *cup; struct cld_upcall *cup;
/* FIXME: determine net from clp */ struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id);
struct cld_net *cn = nn->cld_net; struct cld_net *cn = nn->cld_net;
/* Don't upcall if one was already stored during this grace pd */ /* Don't upcall if one was already stored during this grace pd */
......
...@@ -1263,10 +1263,9 @@ same_creds(struct svc_cred *cr1, struct svc_cred *cr2) ...@@ -1263,10 +1263,9 @@ same_creds(struct svc_cred *cr1, struct svc_cred *cr2)
return 0 == strcmp(cr1->cr_principal, cr2->cr_principal); return 0 == strcmp(cr1->cr_principal, cr2->cr_principal);
} }
static void gen_clid(struct nfs4_client *clp) static void gen_clid(struct nfs4_client *clp, struct nfsd_net *nn)
{ {
static u32 current_clientid = 1; static u32 current_clientid = 1;
struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id);
clp->cl_clientid.cl_boot = nn->boot_time; clp->cl_clientid.cl_boot = nn->boot_time;
clp->cl_clientid.cl_id = current_clientid++; clp->cl_clientid.cl_id = current_clientid++;
...@@ -1305,6 +1304,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name, ...@@ -1305,6 +1304,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name,
struct nfs4_client *clp; struct nfs4_client *clp;
struct sockaddr *sa = svc_addr(rqstp); struct sockaddr *sa = svc_addr(rqstp);
int ret; int ret;
struct net *net = SVC_NET(rqstp);
clp = alloc_client(name); clp = alloc_client(name);
if (clp == NULL) if (clp == NULL)
...@@ -1335,6 +1335,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name, ...@@ -1335,6 +1335,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name,
rpc_copy_addr((struct sockaddr *) &clp->cl_addr, sa); rpc_copy_addr((struct sockaddr *) &clp->cl_addr, sa);
gen_confirm(clp); gen_confirm(clp);
clp->cl_cb_session = NULL; clp->cl_cb_session = NULL;
clp->net = net;
return clp; return clp;
} }
...@@ -1471,7 +1472,7 @@ gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se, struct svc_r ...@@ -1471,7 +1472,7 @@ gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se, struct svc_r
else else
goto out_err; goto out_err;
conn->cb_addrlen = rpc_uaddr2sockaddr(&init_net, se->se_callback_addr_val, conn->cb_addrlen = rpc_uaddr2sockaddr(clp->net, se->se_callback_addr_val,
se->se_callback_addr_len, se->se_callback_addr_len,
(struct sockaddr *)&conn->cb_addr, (struct sockaddr *)&conn->cb_addr,
sizeof(conn->cb_addr)); sizeof(conn->cb_addr));
...@@ -1619,6 +1620,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, ...@@ -1619,6 +1620,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp,
nfs4_verifier verf = exid->verifier; nfs4_verifier verf = exid->verifier;
struct sockaddr *sa = svc_addr(rqstp); struct sockaddr *sa = svc_addr(rqstp);
bool update = exid->flags & EXCHGID4_FLAG_UPD_CONFIRMED_REC_A; bool update = exid->flags & EXCHGID4_FLAG_UPD_CONFIRMED_REC_A;
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
rpc_ntop(sa, addr_str, sizeof(addr_str)); rpc_ntop(sa, addr_str, sizeof(addr_str));
dprintk("%s rqstp=%p exid=%p clname.len=%u clname.data=%p " dprintk("%s rqstp=%p exid=%p clname.len=%u clname.data=%p "
...@@ -1701,7 +1703,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, ...@@ -1701,7 +1703,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp,
} }
new->cl_minorversion = 1; new->cl_minorversion = 1;
gen_clid(new); gen_clid(new, nn);
add_to_unconfirmed(new); add_to_unconfirmed(new);
out_copy: out_copy:
exid->clientid.cl_boot = new->cl_clientid.cl_boot; exid->clientid.cl_boot = new->cl_clientid.cl_boot;
...@@ -2229,7 +2231,8 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -2229,7 +2231,8 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
nfs4_verifier clverifier = setclid->se_verf; nfs4_verifier clverifier = setclid->se_verf;
struct nfs4_client *conf, *unconf, *new; struct nfs4_client *conf, *unconf, *new;
__be32 status; __be32 status;
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
/* Cases below refer to rfc 3530 section 14.2.33: */ /* Cases below refer to rfc 3530 section 14.2.33: */
nfs4_lock_state(); nfs4_lock_state();
conf = find_confirmed_client_by_name(&clname); conf = find_confirmed_client_by_name(&clname);
...@@ -2258,7 +2261,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -2258,7 +2261,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
/* case 1: probable callback update */ /* case 1: probable callback update */
copy_clid(new, conf); copy_clid(new, conf);
else /* case 4 (new client) or cases 2, 3 (client reboot): */ else /* case 4 (new client) or cases 2, 3 (client reboot): */
gen_clid(new); gen_clid(new, nn);
new->cl_minorversion = 0; new->cl_minorversion = 0;
gen_callback(new, setclid, rqstp); gen_callback(new, setclid, rqstp);
add_to_unconfirmed(new); add_to_unconfirmed(new);
......
...@@ -283,6 +283,7 @@ struct nfs4_client { ...@@ -283,6 +283,7 @@ struct nfs4_client {
unsigned long cl_cb_slot_busy; unsigned long cl_cb_slot_busy;
struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */ struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
/* wait here for slots */ /* wait here for slots */
struct net *net;
}; };
static inline void static inline void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册