mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kent Overstreet <koverstreet@google.com>
To: akpm@linux-foundation.org
Cc: Kent Overstreet <koverstreet@google.com>,
	Valdis.Kletnieks@vt.edu, dhillf@gmail.com, bcrl@kvack.org,
	zab@zabbo.net, linux-kernel@vger.kernel.org, linux-aio@kvack.org,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/3] aio-kill-ki_retry-fix-fix
Date: Thu, 24 Jan 2013 13:43:52 -0800	[thread overview]
Message-ID: <1359063833-17174-2-git-send-email-koverstreet@google.com> (raw)
In-Reply-To: <1359063833-17174-1-git-send-email-koverstreet@google.com>
In-Reply-To: <20130124211850.GH26407@google.com>

The "aio: kill ki-retry" patch was assuming that we didn't touch struct
kiocb after passing it off to something that would call aio_complete() -
which was wrong. So, revert the refcounting changes.

Signed-off-by: Kent Overstreet <koverstreet@google.com>
---
 fs/aio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index 0d2f39d..85d1b38 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -592,7 +592,7 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx)
 
 	memset(req, 0, offsetof(struct kiocb, ki_ctx));
 	req->ki_ctx = ctx;
-	atomic_set(&req->ki_users, 1);
+	atomic_set(&req->ki_users, 2);
 	return req;
 out_put:
 	put_reqs_available(ctx, 1);
@@ -1291,10 +1291,12 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
 	if (ret)
 		goto out_put_req;
 
+	aio_put_req(req);	/* drop extra ref to req */
 	return 0;
 out_put_req:
 	put_reqs_available(ctx, 1);
-	aio_put_req(req);
+	aio_put_req(req);	/* drop extra ref to req */
+	aio_put_req(req);	/* drop i/o ref to req */
 	return ret;
 }
 
-- 
1.7.12


  parent reply	other threads:[~2013-01-24 21:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-21 13:24 next-20130117 - kernel BUG with aio Valdis Kletnieks
2013-01-22 13:43 ` Hillf Danton
2013-01-22 21:28   ` Valdis.Kletnieks
2013-01-23 12:10     ` Hillf Danton
2013-01-24 17:22       ` Valdis.Kletnieks
2013-01-24 21:18         ` Kent Overstreet
2013-01-24 21:27           ` Andrew Morton
2013-01-24 21:39             ` Kent Overstreet
2013-01-24 22:25               ` Zach Brown
2013-01-24 22:47                 ` Jeff Moyer
2013-01-24 23:03                 ` Kent Overstreet
2013-01-24 22:13             ` Kent Overstreet
2013-01-29 13:41               ` Jan Kara
2013-01-24 21:43           ` [PATCH 1/3] aio: Fix a null pointer deref in batch_complete_aio Kent Overstreet
2013-01-25 13:15             ` Hillf Danton
2013-01-24 21:43           ` Kent Overstreet [this message]
2013-01-24 21:43           ` [PATCH 3/3] aio-use-cancellation-list-lazily-fix Kent Overstreet
2013-01-25 13:30             ` Hillf Danton
2013-01-25 23:12               ` Andrew Morton
2013-01-28 17:37                 ` Kent Overstreet
2013-01-31 21:59     ` next-20130117 - kernel BUG with aio Andrew Morton
2013-02-01  0:37       ` Kent Overstreet
2013-02-05 15:53         ` Valdis.Kletnieks
2013-02-05 17:20           ` Kent Overstreet
2013-02-05 17:48             ` Valdis.Kletnieks
2013-02-06 17:15             ` Valdis.Kletnieks

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=1359063833-17174-2-git-send-email-koverstreet@google.com \
    --to=koverstreet@google.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=bcrl@kvack.org \
    --cc=dhillf@gmail.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zab@zabbo.net \
    /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®