mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Сергей Темерханов" <temerkhanov@cifronik.ru>
To: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH resubmit 2/3] AIO: Fix reference counting in io_cancel and aio_cancel_all
Date: Tue, 16 Mar 2010 19:26:04 +0300	[thread overview]
Message-ID: <201003161926.04434.temerkhanov@cifronik.ru> (raw)
In-Reply-To: <x494okguxxp.fsf@segfault.boston.devel.redhat.com>

[-- Attachment #1: Type: Text/Plain, Size: 1049 bytes --]

On Tuesday 16 March 2010 17:46:10 Jeff Moyer wrote:
> Sergey Temerkhanov <temerkhanov@cifronik.ru> writes:
> > io_cancel() and aio_cancel_all() have inconsistent reference counting
> > (ki_users field of struct kiocb) which leads to unkillable processes upon
> > io_cancel() or io_destroy() syscalls. This patch fixes the undesired
> > behavior.
> 
> Hi, Sergey,
> 
> Thanks for the patch.  Would you mind resubmitting it to make it a bit
> easier to review?  The way you've done things, it is difficult to tell
> if you just moved the aio_cancel_all function or if you moved it and
> made changes.  Please have the patch that moves it separated out from
> other changes, or at least mention in the changelog that the function
> was unchanged.  Next, if you could tell what sorts of testing you've
> performed, that would be great.  Finally, it would be a good idea to CC
> linux-aio@kvack.org on aio patches.
> 
> Thanks!
> Jeff
> 

This patch fixes reference counting in io_cancel() and aio_cancel_all()

Regards, Sergey Temerkhanov, Cifronic ZAO

[-- Attachment #2: aio-fix.patch --]
[-- Type: text/x-patch, Size: 535 bytes --]

diff -r 74c172a99cdb fs/aio.c
--- a/fs/aio.c	Tue Mar 16 18:55:59 2010 +0300
+++ b/fs/aio.c	Tue Mar 16 19:08:49 2010 +0300
@@ -1035,7 +1035,9 @@
 			spin_unlock_irq(&ctx->ctx_lock);
 			cancel(iocb, &res);
 			spin_lock_irq(&ctx->ctx_lock);
+			__aio_put_req(req);
 		}
+		__aio_put_req(req);
 	}
 	spin_unlock_irq(&ctx->ctx_lock);
 }
@@ -1789,9 +1791,11 @@
 			if (copy_to_user(result, &tmp, sizeof(tmp)))
 				ret = -EFAULT;
 		}
+		aio_put_req(req);
 	} else
 		ret = -EINVAL;
 
+	aio_put_req(req);
 	put_ioctx(ctx);
 
 	return ret;

  reply	other threads:[~2010-03-16 16:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 11:18 [PATCH 1/2] " Sergey Temerkhanov
2010-03-16 11:29 ` [PATCH 2/2] AIO: Change pr_debug statements to dprintk in fs/aio.c Sergey Temerkhanov
2010-03-16 14:49   ` Jeff Moyer
2010-03-16 14:46 ` [PATCH 1/2] AIO: Fix reference counting in io_cancel and aio_cancel_all Jeff Moyer
2010-03-16 16:26   ` Сергей Темерханов [this message]
2010-03-16 16:30   ` [PATCH resubmit 3/3] AIO: Change dprintk statements to pr_debug Сергей Темерханов
2010-03-16 16:30   ` [PATCH resubmit 1/3] AIO: Move aio_cancel_all() Сергей Темерханов

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=201003161926.04434.temerkhanov@cifronik.ru \
    --to=temerkhanov@cifronik.ru \
    --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®