Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759589Ab3DBBcg (ORCPT ); Mon, 1 Apr 2013 21:32:36 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:57974 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753840Ab3DBBce (ORCPT ); Mon, 1 Apr 2013 21:32:34 -0400 Date: Mon, 1 Apr 2013 21:32:14 -0400 From: "Theodore Ts'o" To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org, akpm@linux-foundation.org, Zach Brown , Felipe Balbi , Greg Kroah-Hartman , Mark Fasheh , Joel Becker , Rusty Russell , Jens Axboe , Asai Thambi S P , Selvan Mani , Sam Bradshaw , Jeff Moyer , Al Viro , Benjamin LaHaise Subject: Re: [PATCH 12/33] aio: refcounting cleanup Message-ID: <20130402013214.GA30122@thunk.org> Mail-Followup-To: Theodore Ts'o , Kent Overstreet , linux-kernel@vger.kernel.org, linux-aio@kvack.org, akpm@linux-foundation.org, Zach Brown , Felipe Balbi , Greg Kroah-Hartman , Mark Fasheh , Joel Becker , Rusty Russell , Jens Axboe , Asai Thambi S P , Selvan Mani , Sam Bradshaw , Jeff Moyer , Al Viro , Benjamin LaHaise References: <1363883754-27966-1-git-send-email-koverstreet@google.com> <1363883754-27966-13-git-send-email-koverstreet@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1363883754-27966-13-git-send-email-koverstreet@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1845 Lines: 46 On Thu, Mar 21, 2013 at 09:35:33AM -0700, Kent Overstreet wrote: > The usage of ctx->dead was fubar - it makes no sense to explicitly check > it all over the place, especially when we're already using RCU. > > Now, ctx->dead only indicates whether we've dropped the initial > refcount. The new teardown sequence is: > set ctx->dead > hlist_del_rcu(); > synchronize_rcu(); > > Now we know no system calls can take a new ref, and it's safe to drop > the initial ref: > put_ioctx(); > > We also need to ensure there are no more outstanding kiocbs. This was > done incorrectly - it was being done in kill_ctx(), and before dropping > the initial refcount. At this point, other syscalls may still be > submitting kiocbs! > > Now, we cancel and wait for outstanding kiocbs in free_ioctx(), after > kioctx->users has dropped to 0 and we know no more iocbs could be > submitted. > > Signed-off-by: Kent Overstreet > Cc: Zach Brown > Cc: Felipe Balbi > Cc: Greg Kroah-Hartman > Cc: Mark Fasheh > Cc: Joel Becker > Cc: Rusty Russell > Cc: Jens Axboe > Cc: Asai Thambi S P > Cc: Selvan Mani > Cc: Sam Bradshaw > Cc: Jeff Moyer > Cc: Al Viro > Cc: Benjamin LaHaise > Cc: Theodore Ts'o > Signed-off-by: Andrew Morton Reviewed-by: "Theodore Ts'o" -- 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/