lkml.org 
[lkml]   [2003]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] Small bug fix for aio
From
Date
Hi,

Here is a trivial patch fixed a bug in ioctx_alloc(). If
aio_setup_ring() failed, ioctx_alloc() should pass the return error from
aio_setup_ring() back to sys_io_setup().

Please apply. Thanks.
diff -urNp linux-2.5.68/fs/aio.c 2568/fs/aio.c
--- linux-2.5.68/fs/aio.c Sat Apr 19 19:49:25 2003
+++ 2568/fs/aio.c Tue Apr 22 17:52:21 2003
@@ -204,6 +204,7 @@ static struct kioctx *ioctx_alloc(unsign
{
struct mm_struct *mm;
struct kioctx *ctx;
+ int ret = 0;

/* Prevent overflows */
if ((nr_events > (0x10000000U / sizeof(struct io_event))) ||
@@ -233,7 +234,8 @@ static struct kioctx *ioctx_alloc(unsign
INIT_LIST_HEAD(&ctx->run_list);
INIT_WORK(&ctx->wq, aio_kick_handler, ctx);

- if (aio_setup_ring(ctx) < 0)
+ ret = aio_setup_ring(ctx);
+ if (unlikely(ret < 0))
goto out_freectx;

/* limit the number of system wide aios */
@@ -259,7 +261,7 @@ out_cleanup:

out_freectx:
kmem_cache_free(kioctx_cachep, ctx);
- ctx = ERR_PTR(-ENOMEM);
+ ctx = ERR_PTR(ret);

dprintk("aio: error allocating ioctx %p\n", ctx);
return ctx;
\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.029 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site