From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCRcA-0001Cu-Vs for qemu-devel@nongnu.org; Thu, 22 Aug 2013 05:55:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCRc3-00014g-7C for qemu-devel@nongnu.org; Thu, 22 Aug 2013 05:55:38 -0400 Received: from e28smtp07.in.ibm.com ([122.248.162.7]:40615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCRc2-00014F-Ix for qemu-devel@nongnu.org; Thu, 22 Aug 2013 05:55:31 -0400 Received: from /spool/local by e28smtp07.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Aug 2013 15:16:24 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 4DB22E0059 for ; Thu, 22 Aug 2013 15:25:54 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7M9urd041222256 for ; Thu, 22 Aug 2013 15:26:54 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7M9tMR2004187 for ; Thu, 22 Aug 2013 15:25:22 +0530 Date: Thu, 22 Aug 2013 15:25:42 +0530 From: Bharata B Rao Message-ID: <20130822095542.GA2755@in.ibm.com> References: <1377050567-19122-1-git-send-email-asias@redhat.com> <20130821152440.GB18303@stefanha-thinkpad.redhat.com> <5214DF5B.50203@redhat.com> <20130822055947.GB24870@in.ibm.com> <20130822074846.GC10412@stefanha-thinkpad.redhat.com> <5215D4A7.60501@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5215D4A7.60501@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: Fix race in gluster_finish_aiocb Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Vijay Bellur , Stefan Hajnoczi , qemu-devel@nongnu.org, Stefan Hajnoczi , Asias He , MORITA Kazutaka On Thu, Aug 22, 2013 at 11:06:47AM +0200, Paolo Bonzini wrote: > Il 22/08/2013 09:48, Stefan Hajnoczi ha scritto: > >> > gluster_finish_aiocb gets called from gluster thread, is it safe to create > >> > and schedule a bh from such a thread ? > >> > > >> > In my first implementation (http://lists.gnu.org/archive/html/qemu-devel/2012-06/msg01748.html), I was using a BH from qemu read side thread (the thread > >> > that would respond to pipe write from gluster callback thread). That > >> > implementation was based on rbd and I later dropped the BH part since it > >> > looked like a round about way of completing the aio when we are already using > >> > the pipe mechanism for aio completion. > > Recent patches made creating and scheduling a BH thread-safe. > > I thought scheduling BHs was always thread safe? > > > I think Paolo's idea is better than mine. > > Both are fine, they are just different. Mine is simpler because it > leaves list management to the BH code. > > But since we are at it, we should simplify the code and uniformly use a > bottom half for both successful and erroneous completions. This applies > to both ideas. > > Maybe an even simpler patch would be to just abort if the > GLUSTER_FD_WRITE write fails. This was the first apporach I had. I used to abort when writes to pipe fail. But there were concerns raised about handling the failures gracefully and hence we ended up doing all that error handling of completing the aio with -EIO, closing the pipe and making the disk inaccessible. > Under what circumstances could it happen? Not very sure, I haven't seen that happening. I had to manually inject faults to test this error path and verify the graceful recovery. Regards, Bharata.