mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mingming Cao <cmm@us.ibm.com>
To: bcrl@redhat.com, akpm@digeo.com
Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org
Subject: [PATCH] Small bug fix for aio
Date: 22 Apr 2003 18:54:51 -0700	[thread overview]
Message-ID: <1051062904.2808.37.camel@w-ming.beaverton.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

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.

[-- Attachment #2: aiofix.patch --]
[-- Type: text/x-patch, Size: 887 bytes --]

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;

             reply	other threads:[~2003-04-23  1:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-23  1:54 Mingming Cao [this message]
2003-04-24  3:14 ` Benjamin LaHaise
2003-04-24 20:21   ` Mingming Cao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1051062904.2808.37.camel@w-ming.beaverton.ibm.com \
    --to=cmm@us.ibm.com \
    --cc=akpm@digeo.com \
    --cc=bcrl@redhat.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®