SUNRPC: call_connect_status() must handle tasks that got transmitted
Subsystems (3)
PATCH v3 1/3 SUNRPC: call_connect_status() must handle tasks that got transmitted
If a task failed to get the write lock in the call to xprt_connect(), then it will be queued on xprt->sending. In that case, it is possible for it to get transmitted before the call to call_connect_status(), in which case it needs to be handled by call_transmit_status() instead.
--- net/sunrpc/clnt.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/sunrpc/clnt.c +7 -0
@@ -1915,6 +1915,13 @@ call_connect_status(struct rpc_task *task)struct rpc_clnt *clnt = task->tk_client;int status = task->tk_status; +/* Check if the task was already transmitted */ +if (!test_bit (RPC_TASK_NEED_XMIT , &task->tk_runstate)) { +xprt_end_transmit (task); + task->tk_action = call_transmit_status; +return ; + } +dprint_status (task);trace_rpc_connect_status (task);
Signature · 1 line
2.19.2
PATCH v3 2/3 SUNRPC: Fix leak of krb5p encode pages
From: Chuck Lever <[email protected]>
call_encode can be invoked more than once per RPC call. Ensure that each call to gss_wrap_req_priv does not overwrite pointers to previously allocated memory.
--- net/sunrpc/auth_gss/auth_gss.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sunrpc/auth_gss/auth_gss.c +4 -0
@@ -1791,6 +1791,7 @@ priv_release_snd_buf(struct rpc_rqst *rqstp)for (i=0 ; i < rqstp->rq_enc_pages_num; i++)__free_page (rqstp->rq_enc_pages[i]);kfree (rqstp->rq_enc_pages); + rqstp->rq_release_snd_buf =NULL ; } static int
@@ -1799,6 +1800,9 @@ alloc_enc_pages(struct rpc_rqst *rqstp)struct xdr_buf *snd_buf = &rqstp->rq_snd_buf;int first, last, i; +if (rqstp->rq_release_snd_buf) + rqstp->rq_release_snd_buf (rqstp); +if (snd_buf->page_len ==0 ) { rqstp->rq_enc_pages_num =0 ;return 0 ;
Signature · 1 line
2.19.2
PATCH v3 3/3 SUNRPC: Ensure we refresh the bvec after RPCSEC_GSS encoding
A call to gss_wrap_req_priv() will end up replacing the original array in rqstp->rq_snd_buf.pages with a new one containing the encrypted data. In order to avoid having the rqstp->rq_snd_buf.bvec point to the wrong page data, we need to refresh that too.
--- include/linux/sunrpc/xdr.h | 1 - net/sunrpc/xprt.c | 2 ++ net/sunrpc/xprtsock.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
include/linux/sunrpc/xdr.h +0 -1
@@ -72,7 +72,6 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) buf->head[0 ].iov_base = start; buf->head[0 ].iov_len = len; buf->tail[0 ].iov_len =0 ; - buf->bvec =NULL ; buf->pages =NULL ; buf->page_len =0 ; buf->flags =0 ;
net/sunrpc/xprt.c +2 -0
@@ -1623,6 +1623,8 @@ xprt_request_init(struct rpc_task *task) req->rq_snd_buf.buflen =0 ; req->rq_rcv_buf.len =0 ; req->rq_rcv_buf.buflen =0 ; + req->rq_snd_buf.bvec =NULL ; + req->rq_rcv_buf.bvec =NULL ; req->rq_release_snd_buf =NULL ;xprt_reset_majortimeo (req); dprintk("RPC: %5u reserved req %p xid %08x\n", task->tk_pid,
net/sunrpc/xprtsock.c +1 -0
@@ -843,6 +843,7 @@ static int xs_nospace(struct rpc_rqst *req)static void xs_stream_prepare_request (struct rpc_rqst *req) { +xdr_free_bvec (&req->rq_rcv_buf); req->rq_task->tk_status =xdr_alloc_bvec (&req->rq_rcv_buf,GFP_NOIO ); }
Signature · 1 line
2.19.2
Re: [PATCH v3 3/3] SUNRPC: Ensure we refresh the bvec after RPCSEC_GSS encoding
Quoted 8 lines · Trond Myklebust
A call to
gss_wrap_req_priv()will end up replacing the original array inrqstp->rq_snd_buf.pageswith a new one containing the encrypted data. In order to avoid having therqstp->rq_snd_buf.bvecpoint to the wrong page data, we need to refresh that too.
I would add a note here that this patch fixes a memory leak. And you might want to add a Fixes: tag.
I'm trying it out now.
Quoted 41 lines
Signed-off-by Trond Myklebust <[email protected]>---
include/linux/sunrpc/xdr.h | 1 - net/sunrpc/xprt.c | 2 ++ net/sunrpc/xprtsock.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)include/linux/sunrpc/xdr.h +0
-1@@ -72,7 +72,6 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) buf->head[0 ].iov_base = start; buf->head[0 ].iov_len = len; buf->tail[0 ].iov_len =0 ; - buf->bvec =NULL ; buf->pages =NULL ; buf->page_len =0 ; buf->flags =0 ;net/sunrpc/xprt.c +2
-0@@ -1623,6 +1623,8 @@ xprt_request_init(struct rpc_task *task) req->rq_snd_buf.buflen =0 ; req->rq_rcv_buf.len =0 ; req->rq_rcv_buf.buflen =0 ; + req->rq_snd_buf.bvec =NULL ; + req->rq_rcv_buf.bvec =NULL ; req->rq_release_snd_buf =NULL ;xprt_reset_majortimeo (req); dprintk("RPC: %5u reserved req %p xid %08x\n", task->tk_pid,net/sunrpc/xprtsock.c +0
-0@@ -843,6 +843,7 @@ static int xs_nospace(struct rpc_rqst *req)static void
xs_stream_prepare_request(struct rpc_rqst *req)
{net/sunrpc/xprtsock.c +1
-0+xdr_free_bvec (&req->rq_rcv_buf);
Quoted 6 lines
req->rq_task->tk_status = xdr_alloc_bvec(&req->rq_rcv_buf, GFP_NOIO); }Signature · 1 line
2.19.2
--
Chuck Lever
Re: [PATCH v3 3/3] SUNRPC: Ensure we refresh the bvec after RPCSEC_GSS encoding
Quoted 10 lines · Chuck Lever
Quoted 9 lines
On Nov 30, 2018, at 4:55 PM, Trond Myklebust <[email protected]> wrote:
A call to
gss_wrap_req_priv()will end up replacing the original array
inrqstp->rq_snd_buf.pageswith a new one containing the encrypted data. In order to avoid having therqstp->rq_snd_buf.bvecpoint to the
wrong page data, we need to refresh that too.
Quoted 3 lines
I would add a note here that this patch fixes a memory leak. And you might want to add a Fixes: tag.
It only applies to new code that went into 4.20, so it won't need any stable backporting.
That said, I'm realising (slowly - apparently I'm asleep today) that this is receive side code, so
a) The contents of rq_snd_buf are irrelevant.
b) We want to beware of changing it while there is a copy in rq_private_buf.
IOW: a v4 is forthcoming.
Quoted 59 lines
I'm trying it out now.
Quoted 44 lines
Signed-off-by Trond Myklebust <[email protected]>---
include/linux/sunrpc/xdr.h | 1 - net/sunrpc/xprt.c | 2 ++ net/sunrpc/xprtsock.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)include/linux/sunrpc/xdr.h +0
-1@@ -72,7 +72,6 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) buf->head[0].iov_base = start; buf->head[0 ].iov_len = len; buf->tail[0 ].iov_len =0 ; - buf->bvec =NULL ; buf->pages =NULL ; buf->page_len =0 ;buf->flags = 0;net/sunrpc/xprt.c +2
-0@@ -1623,6 +1623,8 @@ xprt_request_init(struct rpc_task *task) req->rq_snd_buf.buflen =0 ; req->rq_rcv_buf.len =0 ; req->rq_rcv_buf.buflen =0 ; + req->rq_snd_buf.bvec =NULL ; + req->rq_rcv_buf.bvec =NULL ; req->rq_release_snd_buf =NULL ;xprt_reset_majortimeo (req); dprintk("RPC: %5u reserved req %p xid %08x\n", task->tk_pid,net/sunrpc/xprtsock.c +0
-0@@ -843,6 +843,7 @@ static int xs_nospace(struct rpc_rqst *req)static void
xs_stream_prepare_request(struct rpc_rqst *req)
{net/sunrpc/xprtsock.c +1
-0+xdr_free_bvec (&req->rq_rcv_buf);req->rq_task->tk_status = xdr_alloc_bvec(&req->rq_rcv_buf,Quoted 6 lines
GFP_NOIO);
}Signature · 1 line
2.19.2--
Chuck Lever
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected]
Re: [PATCH v3 3/3] SUNRPC: Ensure we refresh the bvec after RPCSEC_GSS encoding
Quoted 22 lines · Trond Myklebust
Quoted 10 lines · Chuck Lever
Quoted 9 lines
On Nov 30, 2018, at 4:55 PM, Trond Myklebust <[email protected]> wrote:
A call to
gss_wrap_req_priv()will end up replacing the original array
inrqstp->rq_snd_buf.pageswith a new one containing the encrypted data. In order to avoid having therqstp->rq_snd_buf.bvecpoint to the
wrong page data, we need to refresh that too.Quoted 3 lines
I would add a note here that this patch fixes a memory leak. And you might want to add a Fixes: tag.
It only applies to new code that went into 4.20, so it won't need any stable backporting.
Quoted 8 lines
That said, I'm realising (slowly - apparently I'm asleep today) that this is receive side code, so
a) The contents of
rq_snd_bufare irrelevant.
b) We want to beware of changing it while there is a copy inrq_private_buf.IOW: a v4 is forthcoming.
fwiw, i see the soft IRQ warnings with NFS/RDMA too.
I would like to turn those into a pr_warn_rate_limited. I don't see much point in the backtrace blather.
Quoted 50 lines
Quoted 50 lines
I'm trying it out now.
Quoted 47 lines
Signed-off-by Trond Myklebust <[email protected]>---
include/linux/sunrpc/xdr.h | 1 - net/sunrpc/xprt.c | 2 ++ net/sunrpc/xprtsock.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)include/linux/sunrpc/xdr.h +0
-1@@ -72,7 +72,6 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) buf->head[0].iov_base = start; buf->head[0 ].iov_len = len; buf->tail[0 ].iov_len =0 ; - buf->bvec =NULL ; buf->pages =NULL ; buf->page_len =0 ;buf->flags = 0;net/sunrpc/xprt.c +2
-0@@ -1623,6 +1623,8 @@ xprt_request_init(struct rpc_task *task) req->rq_snd_buf.buflen =0 ; req->rq_rcv_buf.len =0 ; req->rq_rcv_buf.buflen =0 ; + req->rq_snd_buf.bvec =NULL ; + req->rq_rcv_buf.bvec =NULL ; req->rq_release_snd_buf =NULL ;xprt_reset_majortimeo (req); dprintk("RPC: %5u reserved req %p xid %08x\n", task->tk_pid,net/sunrpc/xprtsock.c +0
-0@@ -843,6 +843,7 @@ static int xs_nospace(struct rpc_rqst *req)static void
xs_stream_prepare_request(struct rpc_rqst *req)
{net/sunrpc/xprtsock.c +1
-0+xdr_free_bvec (&req->rq_rcv_buf);req->rq_task->tk_status = xdr_alloc_bvec(&req->rq_rcv_buf,
GFP_NOIO);
}
Quoted 13 lines
Quoted 9 lines
Quoted 3 lines
Signature · 1 line
2.19.2--
Chuck LeverSignature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected]
--
Chuck Lever
Re: [PATCH v3 3/3] SUNRPC: Ensure we refresh the bvec after RPCSEC_GSS encoding
Quoted 34 lines · Chuck Lever
Quoted 34 lines
On Nov 30, 2018, at 5:18 PM, Trond Myklebust <
[email protected]> wrote:Quoted 14 lines · Chuck Lever
Quoted 4 lines
On Nov 30, 2018, at 4:55 PM, Trond Myklebust <[email protected]
Quoted 1 line
wrote:
Quoted 9 lines
A call to
gss_wrap_req_priv()will end up replacing the original
array
inrqstp->rq_snd_buf.pageswith a new one containing the encrypted
data. In order to avoid having therqstp->rq_snd_buf.bvecpoint to
the
wrong page data, we need to refresh that too.Quoted 3 lines
I would add a note here that this patch fixes a memory leak. And you might want to add a Fixes: tag.
It only applies to new code that went into 4.20, so it won't need any
stable backporting.That said, I'm realising (slowly - apparently I'm asleep today) that
this is receive side code, soa) The contents of
rq_snd_bufare irrelevant.
b) We want to beware of changing it while there is a copy inrq_private_buf.
Quoted 7 lines
Quoted 1 line
IOW: a v4 is forthcoming.
fwiw, i see the soft IRQ warnings with NFS/RDMA too.
I would like to turn those into a
pr_warn_rate_limited. I don't see much point in the backtrace blather.
Your initial email mentioned these soft IRQ warnings, but didn't provide an example. Which warnings are these exactly, and where are they coming from?
Signature · 4 lines
-- Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected]
Re: [PATCH v3 3/3] SUNRPC: Ensure we refresh the bvec after RPCSEC_GSS encoding
Quoted 43 lines · Trond Myklebust
Quoted 38 lines · Chuck Lever
Quoted 30 lines
On Nov 30, 2018, at 5:18 PM, Trond Myklebust <
[email protected]> wrote:Quoted 14 lines · Chuck Lever
Quoted 4 lines
On Nov 30, 2018, at 4:55 PM, Trond Myklebust <[email protected]
Quoted 1 line
wrote:
Quoted 9 lines
A call to
gss_wrap_req_priv()will end up replacing the original
array
inrqstp->rq_snd_buf.pageswith a new one containing the encrypted
data. In order to avoid having therqstp->rq_snd_buf.bvecpoint to
the
wrong page data, we need to refresh that too.Quoted 3 lines
I would add a note here that this patch fixes a memory leak. And you might want to add a Fixes: tag.
It only applies to new code that went into 4.20, so it won't need any
stable backporting.That said, I'm realising (slowly - apparently I'm asleep today) that
this is receive side code, soQuoted 5 lines
a) The contents of
rq_snd_bufare irrelevant.
b) We want to beware of changing it while there is a copy inrq_private_buf.IOW: a v4 is forthcoming.
fwiw, i see the soft IRQ warnings with NFS/RDMA too.
Quoted 7 lines
Quoted 3 lines
I would like to turn those into a
pr_warn_rate_limited. I don't see much point in the backtrace blather.Your initial email mentioned these soft IRQ warnings, but didn't provide an example. Which warnings are these exactly, and where are they coming from?
The WARN_ON in call_decode that fires when rq_rcv_buf does not exactly match rq_private_buf.
--
Chuck Lever
Re: [PATCH v3 3/3] SUNRPC: Ensure we refresh the bvec after RPCSEC_GSS encoding
Quoted 49 lines · Chuck Lever
Quoted 49 lines
On Nov 30, 2018, at 5:30 PM, Trond Myklebust <
[email protected]> wrote:Quoted 44 lines · Chuck Lever
Quoted 33 lines
On Nov 30, 2018, at 5:18 PM, Trond Myklebust <
[email protected]> wrote:Quoted 15 lines · Chuck Lever
Quoted 4 lines
On Nov 30, 2018, at 4:55 PM, Trond Myklebust <
[email protected]
wrote:Quoted 10 lines
A call to
gss_wrap_req_priv()will end up replacing the original
array
inrqstp->rq_snd_buf.pageswith a new one containing the encrypted
data. In order to avoid having therqstp->rq_snd_buf.bvecpoint
to
the
wrong page data, we need to refresh that too.Quoted 4 lines
I would add a note here that this patch fixes a memory leak. And
you might want to add a Fixes: tag.It only applies to new code that went into 4.20, so it won't need
any
stable backporting.That said, I'm realising (slowly - apparently I'm asleep today) that
this is receive side code, soQuoted 5 lines
a) The contents of
rq_snd_bufare irrelevant.
b) We want to beware of changing it while there is a copy inrq_private_buf.IOW: a v4 is forthcoming.
fwiw, i see the soft IRQ warnings with NFS/RDMA too.
I would like to turn those into a
pr_warn_rate_limited. I don't see much point in the backtrace blather.
Quoted 7 lines
Quoted 3 lines
Your initial email mentioned these soft IRQ warnings, but didn't provide an example. Which warnings are these exactly, and where are they coming from?
The
WARN_ONincall_decodethat fires whenrq_rcv_bufdoes not exactly matchrq_private_buf.
Oh that warning... That might actually be triggering on the bvec value clobber.
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected]