mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
nfs4: set source address when callback is generated
when callback is generated in NFSv4 server, it doesn't set the source address. When an alias IP is utilized on NFSv4 server and suppose the client is accessing via that alias IP (e.g. eth0:0), the client invokes the callback to the IP address that is set on the original device (e.g. eth0). This behavior results in timeout of xprt. The patch sets the IP address that the client should invoke callback to. Signed-off-by: Takuma Umeya <tumeya@redhat.com> [bfields@redhat.com: Simplify gen_callback arguments, use helper function] Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
3c72602340
commit
6f3d772fb8
@ -484,6 +484,7 @@ static int setup_callback_client(struct nfs4_client *clp,
|
|||||||
.net = &init_net,
|
.net = &init_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,
|
||||||
.timeout = &timeparms,
|
.timeout = &timeparms,
|
||||||
.program = &cb_program,
|
.program = &cb_program,
|
||||||
.version = 0,
|
.version = 0,
|
||||||
|
@ -1163,10 +1163,26 @@ find_unconfirmed_client_by_str(const char *dname, unsigned int hashval)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rpc_svcaddr2sockaddr(struct sockaddr *sa, unsigned short family, union svc_addr_u *svcaddr)
|
||||||
|
{
|
||||||
|
switch (family) {
|
||||||
|
case AF_INET:
|
||||||
|
((struct sockaddr_in *)sa)->sin_family = AF_INET;
|
||||||
|
((struct sockaddr_in *)sa)->sin_addr = svcaddr->addr;
|
||||||
|
return;
|
||||||
|
case AF_INET6:
|
||||||
|
((struct sockaddr_in6 *)sa)->sin6_family = AF_INET6;
|
||||||
|
((struct sockaddr_in6 *)sa)->sin6_addr = svcaddr->addr6;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se, u32 scopeid)
|
gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se, struct svc_rqst *rqstp)
|
||||||
{
|
{
|
||||||
struct nfs4_cb_conn *conn = &clp->cl_cb_conn;
|
struct nfs4_cb_conn *conn = &clp->cl_cb_conn;
|
||||||
|
struct sockaddr *sa = svc_addr(rqstp);
|
||||||
|
u32 scopeid = rpc_get_scope_id(sa);
|
||||||
unsigned short expected_family;
|
unsigned short expected_family;
|
||||||
|
|
||||||
/* Currently, we only support tcp and tcp6 for the callback channel */
|
/* Currently, we only support tcp and tcp6 for the callback channel */
|
||||||
@ -1192,6 +1208,7 @@ gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se, u32 scopeid)
|
|||||||
|
|
||||||
conn->cb_prog = se->se_callback_prog;
|
conn->cb_prog = se->se_callback_prog;
|
||||||
conn->cb_ident = se->se_callback_ident;
|
conn->cb_ident = se->se_callback_ident;
|
||||||
|
rpc_svcaddr2sockaddr((struct sockaddr *)&conn->cb_saddr, expected_family, &rqstp->rq_daddr);
|
||||||
return;
|
return;
|
||||||
out_err:
|
out_err:
|
||||||
conn->cb_addr.ss_family = AF_UNSPEC;
|
conn->cb_addr.ss_family = AF_UNSPEC;
|
||||||
@ -1768,7 +1785,6 @@ __be32
|
|||||||
nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
||||||
struct nfsd4_setclientid *setclid)
|
struct nfsd4_setclientid *setclid)
|
||||||
{
|
{
|
||||||
struct sockaddr *sa = svc_addr(rqstp);
|
|
||||||
struct xdr_netobj clname = {
|
struct xdr_netobj clname = {
|
||||||
.len = setclid->se_namelen,
|
.len = setclid->se_namelen,
|
||||||
.data = setclid->se_name,
|
.data = setclid->se_name,
|
||||||
@ -1871,7 +1887,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
|||||||
* for consistent minorversion use throughout:
|
* for consistent minorversion use throughout:
|
||||||
*/
|
*/
|
||||||
new->cl_minorversion = 0;
|
new->cl_minorversion = 0;
|
||||||
gen_callback(new, setclid, rpc_get_scope_id(sa));
|
gen_callback(new, setclid, rqstp);
|
||||||
add_to_unconfirmed(new, strhashval);
|
add_to_unconfirmed(new, strhashval);
|
||||||
setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot;
|
setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot;
|
||||||
setclid->se_clientid.cl_id = new->cl_clientid.cl_id;
|
setclid->se_clientid.cl_id = new->cl_clientid.cl_id;
|
||||||
|
@ -96,6 +96,7 @@ struct nfs4_delegation {
|
|||||||
struct nfs4_cb_conn {
|
struct nfs4_cb_conn {
|
||||||
/* SETCLIENTID info */
|
/* SETCLIENTID info */
|
||||||
struct sockaddr_storage cb_addr;
|
struct sockaddr_storage cb_addr;
|
||||||
|
struct sockaddr_storage cb_saddr;
|
||||||
size_t cb_addrlen;
|
size_t cb_addrlen;
|
||||||
u32 cb_prog; /* used only in 4.0 case;
|
u32 cb_prog; /* used only in 4.0 case;
|
||||||
per-session otherwise */
|
per-session otherwise */
|
||||||
|
Loading…
Reference in New Issue
Block a user