From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kent Overstreet Subject: Re: [PATCH 12/25] aio: Refcounting cleanup Date: Wed, 28 Nov 2012 17:12:03 -0800 Message-ID: <20121129011203.GC15094@google.com> References: <1354121029-1376-1-git-send-email-koverstreet@google.com> <1354121029-1376-13-git-send-email-koverstreet@google.com> <20121129001759.GH18574@lenny.home.zabbo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, bcrl@kvack.org, jmoyer@redhat.com, axboe@kernel.dk, viro@zeniv.linux.org.uk To: Zach Brown Return-path: Content-Disposition: inline In-Reply-To: <20121129001759.GH18574@lenny.home.zabbo.net> Sender: owner-linux-aio@kvack.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Nov 28, 2012 at 04:17:59PM -0800, Zach Brown wrote: > > > struct kioctx { > > atomic_t users; > > - int dead; > > + atomic_t dead; > > Do we want to be paranoid and atomic_set() that to 0 when the ioctx is > allocated? I suppose we should, yeah. > > + while (!list_empty(&ctx->active_reqs)) { > > + struct list_head *pos = ctx->active_reqs.next; > > + struct kiocb *iocb = list_kiocb(pos); > > I'd use list_first_entry() and ignore the list_kiocb() wrapper, I think. Fine by me. > > > + if (!atomic_xchg(&ctx->dead, 1)) { > > + hlist_del_rcu(&ctx->list); > > + synchronize_rcu(); > > > + hlist_for_each_entry_rcu(ctx, n, &mm->ioctx_list, list) > > + if (ctx->user_id == ctx_id){ > > + BUG_ON(atomic_read(&ctx->dead)); > > Hmm. Won't it be possible to race lookup and io_destroy() to hit this > BUG? Ouch, yes. Dunno what I was thinking when I added that. -- To unsubscribe, send a message with 'unsubscribe linux-aio' in the body to majordomo@kvack.org. For more info on Linux AIO, see: http://www.kvack.org/aio/ Don't email: aart@kvack.org