Message ID | 20170801111533.16084.35048.stgit@localhost.localdomain |
---|---|
State | New |
Series | "sunrpc: take net from task client only is available" |
Headers | show |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 4a2fe46..e87dc47 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2625,9 +2625,16 @@ void rpc_task_kill_proc_fini(struct net *net) remove_proc_entry("kill-tasks", sn->proc_net_rpc); } +static struct net *rpc_task_net(struct rpc_task *task) +{ + if (task->tk_client) + return rpc_net_ns(task->tk_client); + return task->tk_rqstp->rq_xprt->xprt_net; +} + bool rpc_abort_task(struct rpc_task *task) { - struct net *net = rpc_net_ns(task->tk_client); + struct net *net = rpc_task_net(task); struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); if (!sn->kill_tasks)
https://jira.sw.ru/browse/PSBM-69434 -- Best regards, Konstantin Khorenko, Virtuozzo Linux Kernel Team On 08/01/2017 02:16 PM, Stanislav Kinsburskiy wrote: > SUNRPC task can have no RPC client, but RPC request instead (this is a piece > of NFSv4.1 callback magic). > In this case network has be taken from tk->rqstp object. > > Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> > --- > net/sunrpc/clnt.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c > index 4a2fe46..e87dc47 100644 > --- a/net/sunrpc/clnt.c > +++ b/net/sunrpc/clnt.c > @@ -2625,9 +2625,16 @@ void rpc_task_kill_proc_fini(struct net *net) > remove_proc_entry("kill-tasks", sn->proc_net_rpc); > } > > +static struct net *rpc_task_net(struct rpc_task *task) > +{ > + if (task->tk_client) > + return rpc_net_ns(task->tk_client); > + return task->tk_rqstp->rq_xprt->xprt_net; > +} > + > bool rpc_abort_task(struct rpc_task *task) > { > - struct net *net = rpc_net_ns(task->tk_client); > + struct net *net = rpc_task_net(task); > struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); > > if (!sn->kill_tasks) > > . >
On 01.08.2017 14:16, Stanislav Kinsburskiy wrote: > SUNRPC task can have no RPC client, but RPC request instead (this is a piece > of NFSv4.1 callback magic). > In this case network has be taken from tk->rqstp object. > > Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> > --- > net/sunrpc/clnt.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c > index 4a2fe46..e87dc47 100644 > --- a/net/sunrpc/clnt.c > +++ b/net/sunrpc/clnt.c > @@ -2625,9 +2625,16 @@ void rpc_task_kill_proc_fini(struct net *net) > remove_proc_entry("kill-tasks", sn->proc_net_rpc); > } > > +static struct net *rpc_task_net(struct rpc_task *task) > +{ > + if (task->tk_client) > + return rpc_net_ns(task->tk_client); > + return task->tk_rqstp->rq_xprt->xprt_net; > +} > + > bool rpc_abort_task(struct rpc_task *task) > { > - struct net *net = rpc_net_ns(task->tk_client); > + struct net *net = rpc_task_net(task); I have no objections, but just for sure, are there places we also need such changes? > struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); > > if (!sn->kill_tasks) >
On 01.08.2017 14:16, Stanislav Kinsburskiy wrote: > SUNRPC task can have no RPC client, but RPC request instead (this is a piece > of NFSv4.1 callback magic). > In this case network has be taken from tk->rqstp object. > > Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com> > --- > net/sunrpc/clnt.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c > index 4a2fe46..e87dc47 100644 > --- a/net/sunrpc/clnt.c > +++ b/net/sunrpc/clnt.c > @@ -2625,9 +2625,16 @@ void rpc_task_kill_proc_fini(struct net *net) > remove_proc_entry("kill-tasks", sn->proc_net_rpc); > } > > +static struct net *rpc_task_net(struct rpc_task *task) > +{ > + if (task->tk_client) > + return rpc_net_ns(task->tk_client); > + return task->tk_rqstp->rq_xprt->xprt_net; > +} > + > bool rpc_abort_task(struct rpc_task *task) > { > - struct net *net = rpc_net_ns(task->tk_client); > + struct net *net = rpc_task_net(task); > struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); > > if (!sn->kill_tasks) >
SUNRPC task can have no RPC client, but RPC request instead (this is a piece of NFSv4.1 callback magic). In this case network has be taken from tk->rqstp object. Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> --- net/sunrpc/clnt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)