* [PATCH] aio: clean up aio ring in the fail path
@ 2013-12-04 10:19 Gu Zheng
2013-12-04 14:54 ` Dave Jones
2013-12-06 15:26 ` Benjamin LaHaise
0 siblings, 2 replies; 7+ messages in thread
From: Gu Zheng @ 2013-12-04 10:19 UTC (permalink / raw)
To: Benjamin
Cc: linux-aio, fsdevel, linux-kernel, Dave Jones, Al Viro, Kent,
Kristian Nielsen
Clean up the aio ring file in the fail path of aio_setup_ring
and ioctx_alloc. And maybe it can fix the GPF issue reported by
Dave Jones:
https://lkml.org/lkml/2013/11/25/898
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
fs/aio.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/aio.c b/fs/aio.c
index 08159ed..6efb7f6 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -367,8 +367,10 @@ static int aio_setup_ring(struct kioctx *ctx)
if (nr_pages > AIO_RING_PAGES) {
ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
GFP_KERNEL);
- if (!ctx->ring_pages)
+ if (!ctx->ring_pages) {
+ put_aio_ring_file(ctx);
return -ENOMEM;
+ }
}
ctx->mmap_size = nr_pages * PAGE_SIZE;
@@ -645,7 +647,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
aio_nr + nr_events < aio_nr) {
spin_unlock(&aio_nr_lock);
err = -EAGAIN;
- goto err;
+ goto err_ctx;
}
aio_nr += ctx->max_reqs;
spin_unlock(&aio_nr_lock);
@@ -662,6 +664,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
err_cleanup:
aio_nr_sub(ctx->max_reqs);
+err_ctx:
+ aio_free_ring(ctx);
err:
free_percpu(ctx->cpu);
free_percpu(ctx->reqs.pcpu_count);
--
1.7.7
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: clean up aio ring in the fail path
2013-12-04 10:19 [PATCH] aio: clean up aio ring in the fail path Gu Zheng
@ 2013-12-04 14:54 ` Dave Jones
2013-12-05 1:14 ` Gu Zheng
2013-12-06 15:26 ` Benjamin LaHaise
1 sibling, 1 reply; 7+ messages in thread
From: Dave Jones @ 2013-12-04 14:54 UTC (permalink / raw)
To: Gu Zheng
Cc: Benjamin, linux-aio, fsdevel, linux-kernel, Al Viro, Kent,
Kristian Nielsen
On Wed, Dec 04, 2013 at 06:19:06PM +0800, Gu Zheng wrote:
> Clean up the aio ring file in the fail path of aio_setup_ring
> and ioctx_alloc. And maybe it can fix the GPF issue reported by
> Dave Jones:
> https://lkml.org/lkml/2013/11/25/898
>
>
> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
> ---
> fs/aio.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 08159ed..6efb7f6 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -367,8 +367,10 @@ static int aio_setup_ring(struct kioctx *ctx)
> if (nr_pages > AIO_RING_PAGES) {
> ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
> GFP_KERNEL);
> - if (!ctx->ring_pages)
> + if (!ctx->ring_pages) {
> + put_aio_ring_file(ctx);
> return -ENOMEM;
> + }
> }
>
CC fs/aio.o
fs/aio.c: In function ‘aio_setup_ring’:
fs/aio.c:363:4: error: implicit declaration of function ‘put_aio_ring_file’ [-Werror=implicit-function-declaration]
put_aio_ring_file(ctx);
Is this dependant on another patch ?
Dave
--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org. For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: clean up aio ring in the fail path
2013-12-04 14:54 ` Dave Jones
@ 2013-12-05 1:14 ` Gu Zheng
2013-12-05 1:22 ` Gu Zheng
0 siblings, 1 reply; 7+ messages in thread
From: Gu Zheng @ 2013-12-05 1:14 UTC (permalink / raw)
To: Dave Jones, Benjamin, linux-aio, fsdevel, linux-kernel, Al Viro,
Kent, Kristian Nielsen
Hi Dave,
On 12/04/2013 10:54 PM, Dave Jones wrote:
> On Wed, Dec 04, 2013 at 06:19:06PM +0800, Gu Zheng wrote:
> > Clean up the aio ring file in the fail path of aio_setup_ring
> > and ioctx_alloc. And maybe it can fix the GPF issue reported by
> > Dave Jones:
> > https://lkml.org/lkml/2013/11/25/898
> >
> >
> > Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
> > ---
> > fs/aio.c | 8 ++++++--
> > 1 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/aio.c b/fs/aio.c
> > index 08159ed..6efb7f6 100644
> > --- a/fs/aio.c
> > +++ b/fs/aio.c
> > @@ -367,8 +367,10 @@ static int aio_setup_ring(struct kioctx *ctx)
> > if (nr_pages > AIO_RING_PAGES) {
> > ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
> > GFP_KERNEL);
> > - if (!ctx->ring_pages)
> > + if (!ctx->ring_pages) {
> > + put_aio_ring_file(ctx);
> > return -ENOMEM;
> > + }
> > }
> >
>
> CC fs/aio.o
> fs/aio.c: In function ‘aio_setup_ring’:
> fs/aio.c:363:4: error: implicit declaration of function ‘put_aio_ring_file’ [-Werror=implicit-function-declaration]
> put_aio_ring_file(ctx);
>
>
> Is this dependant on another patch ?
It's applied on 3.12-rc2. Please ignore the previous defective patch I sent
before, and try again.
Regards,
Gu
>
> Dave
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: clean up aio ring in the fail path
2013-12-05 1:14 ` Gu Zheng
@ 2013-12-05 1:22 ` Gu Zheng
0 siblings, 0 replies; 7+ messages in thread
From: Gu Zheng @ 2013-12-05 1:22 UTC (permalink / raw)
To: Dave Jones, Benjamin, linux-aio, fsdevel, linux-kernel, Al Viro,
Kent, Kristian Nielsen, guz.fnst
On 12/05/2013 09:14 AM, Gu Zheng wrote:
> Hi Dave,
>
> On 12/04/2013 10:54 PM, Dave Jones wrote:
>
>> On Wed, Dec 04, 2013 at 06:19:06PM +0800, Gu Zheng wrote:
>> > Clean up the aio ring file in the fail path of aio_setup_ring
>> > and ioctx_alloc. And maybe it can fix the GPF issue reported by
>> > Dave Jones:
>> > https://lkml.org/lkml/2013/11/25/898
>> >
>> >
>> > Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
>> > ---
>> > fs/aio.c | 8 ++++++--
>> > 1 files changed, 6 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/fs/aio.c b/fs/aio.c
>> > index 08159ed..6efb7f6 100644
>> > --- a/fs/aio.c
>> > +++ b/fs/aio.c
>> > @@ -367,8 +367,10 @@ static int aio_setup_ring(struct kioctx *ctx)
>> > if (nr_pages > AIO_RING_PAGES) {
>> > ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
>> > GFP_KERNEL);
>> > - if (!ctx->ring_pages)
>> > + if (!ctx->ring_pages) {
>> > + put_aio_ring_file(ctx);
>> > return -ENOMEM;
>> > + }
>> > }
>> >
>>
>> CC fs/aio.o
>> fs/aio.c: In function ‘aio_setup_ring’:
>> fs/aio.c:363:4: error: implicit declaration of function ‘put_aio_ring_file’ [-Werror=implicit-function-declaration]
>> put_aio_ring_file(ctx);
>>
>>
>> Is this dependant on another patch ?
>
> It's applied on 3.12-rc2. Please ignore the previous defective patch I sent
Sorry, s/3.12-rc2/3.13-rc2/
> before, and try again.
>
> Regards,
> Gu
>
>>
>> Dave
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>>
>
>
--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org. For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: clean up aio ring in the fail path
2013-12-04 10:19 [PATCH] aio: clean up aio ring in the fail path Gu Zheng
2013-12-04 14:54 ` Dave Jones
@ 2013-12-06 15:26 ` Benjamin LaHaise
2013-12-06 15:34 ` Dave Jones
1 sibling, 1 reply; 7+ messages in thread
From: Benjamin LaHaise @ 2013-12-06 15:26 UTC (permalink / raw)
To: Gu Zheng
Cc: linux-aio, fsdevel, linux-kernel, Dave Jones, Al Viro, Kent,
Kristian Nielsen
On Wed, Dec 04, 2013 at 06:19:06PM +0800, Gu Zheng wrote:
> Clean up the aio ring file in the fail path of aio_setup_ring
> and ioctx_alloc. And maybe it can fix the GPF issue reported by
> Dave Jones:
> https://lkml.org/lkml/2013/11/25/898
Good catch. I've applied this to my aio-next tree. It does indeed look
like it could be the cause of Dave's GPF -- I'll try to trigger it with
some other kernel debug options on and see if the EAGAIN failure case can
trip it up.
-ben
> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
> ---
> fs/aio.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 08159ed..6efb7f6 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -367,8 +367,10 @@ static int aio_setup_ring(struct kioctx *ctx)
> if (nr_pages > AIO_RING_PAGES) {
> ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
> GFP_KERNEL);
> - if (!ctx->ring_pages)
> + if (!ctx->ring_pages) {
> + put_aio_ring_file(ctx);
> return -ENOMEM;
> + }
> }
>
> ctx->mmap_size = nr_pages * PAGE_SIZE;
> @@ -645,7 +647,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
> aio_nr + nr_events < aio_nr) {
> spin_unlock(&aio_nr_lock);
> err = -EAGAIN;
> - goto err;
> + goto err_ctx;
> }
> aio_nr += ctx->max_reqs;
> spin_unlock(&aio_nr_lock);
> @@ -662,6 +664,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
>
> err_cleanup:
> aio_nr_sub(ctx->max_reqs);
> +err_ctx:
> + aio_free_ring(ctx);
> err:
> free_percpu(ctx->cpu);
> free_percpu(ctx->reqs.pcpu_count);
> --
> 1.7.7
>
--
"Thought is the essence of where you are now."
--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org. For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: clean up aio ring in the fail path
2013-12-06 15:26 ` Benjamin LaHaise
@ 2013-12-06 15:34 ` Dave Jones
2013-12-06 15:36 ` Benjamin LaHaise
0 siblings, 1 reply; 7+ messages in thread
From: Dave Jones @ 2013-12-06 15:34 UTC (permalink / raw)
To: Benjamin LaHaise
Cc: Gu Zheng, linux-aio, fsdevel, linux-kernel, Al Viro, Kent,
Kristian Nielsen
On Fri, Dec 06, 2013 at 10:26:54AM -0500, Benjamin LaHaise wrote:
> On Wed, Dec 04, 2013 at 06:19:06PM +0800, Gu Zheng wrote:
> > Clean up the aio ring file in the fail path of aio_setup_ring
> > and ioctx_alloc. And maybe it can fix the GPF issue reported by
> > Dave Jones:
> > https://lkml.org/lkml/2013/11/25/898
>
> Good catch. I've applied this to my aio-next tree. It does indeed look
> like it could be the cause of Dave's GPF -- I'll try to trigger it with
> some other kernel debug options on and see if the EAGAIN failure case can
> trip it up.
I think I forgot to reply and let you know this seems to fix it for me.
Dave
--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org. For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: clean up aio ring in the fail path
2013-12-06 15:34 ` Dave Jones
@ 2013-12-06 15:36 ` Benjamin LaHaise
0 siblings, 0 replies; 7+ messages in thread
From: Benjamin LaHaise @ 2013-12-06 15:36 UTC (permalink / raw)
To: Dave Jones, Gu Zheng, linux-aio, fsdevel, linux-kernel, Al Viro,
Kent, Kristian Nielsen
On Fri, Dec 06, 2013 at 10:34:13AM -0500, Dave Jones wrote:
> On Fri, Dec 06, 2013 at 10:26:54AM -0500, Benjamin LaHaise wrote:
> > On Wed, Dec 04, 2013 at 06:19:06PM +0800, Gu Zheng wrote:
> > > Clean up the aio ring file in the fail path of aio_setup_ring
> > > and ioctx_alloc. And maybe it can fix the GPF issue reported by
> > > Dave Jones:
> > > https://lkml.org/lkml/2013/11/25/898
> >
> > Good catch. I've applied this to my aio-next tree. It does indeed look
> > like it could be the cause of Dave's GPF -- I'll try to trigger it with
> > some other kernel debug options on and see if the EAGAIN failure case can
> > trip it up.
>
> I think I forgot to reply and let you know this seems to fix it for me.
Excellent! I'll send this out and get it queued up for -stable as well.
-ben
> Dave
--
"Thought is the essence of where you are now."
--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org. For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-12-06 15:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-04 10:19 [PATCH] aio: clean up aio ring in the fail path Gu Zheng
2013-12-04 14:54 ` Dave Jones
2013-12-05 1:14 ` Gu Zheng
2013-12-05 1:22 ` Gu Zheng
2013-12-06 15:26 ` Benjamin LaHaise
2013-12-06 15:34 ` Dave Jones
2013-12-06 15:36 ` Benjamin LaHaise
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).