From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932115AbcEEO1x (ORCPT ); Thu, 5 May 2016 10:27:53 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:52689 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756861AbcEEO1v (ORCPT ); Thu, 5 May 2016 10:27:51 -0400 Date: Thu, 5 May 2016 07:27:48 -0700 From: Christoph Hellwig To: Jan Kara Cc: Waiman Long , "Theodore Ts'o" , Andreas Dilger , Alexander Viro , Matthew Wilcox , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Dave Chinner , Christoph Hellwig , Scott J Norton , Douglas Hatch , Toshimitsu Kani Subject: Re: [PATCH v5 1/2] dax: Don't touch i_dio_count in dax_do_io() Message-ID: <20160505142748.GA10157@infradead.org> References: <1461947276-25988-1-git-send-email-Waiman.Long@hpe.com> <1461947276-25988-2-git-send-email-Waiman.Long@hpe.com> <20160505141637.GJ1970@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160505141637.GJ1970@quack2.suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 05, 2016 at 04:16:37PM +0200, Jan Kara wrote: > We cannot easily do this currently - the reason is that in several places we > wait for i_dio_count to drop to 0 (look for inode_dio_wait()) while > holding i_mutex to wait for all outstanding DIO / DAX IO. You'd break this > logic with this patch. > > If we indeed put all writes under i_mutex, this problem would go away but > as Dave explains in his email, we consciously do as much IO as we can > without i_mutex to allow reasonable scalability of multiple writers into > the same file. So the above should be fine for xfs, but you're telling me that ext4 is doing DAX I/O without any inode lock at all? In that case it's indeed not going to work. > The downside of that is that overwrites and writes vs reads are not atomic > wrt each other as POSIX requires. It has been that way for direct IO in XFS > case for a long time, with DAX this non-conforming behavior is proliferating > more. I agree that's not ideal but serializing all writes on a file is > rather harsh for persistent memory as well... For non-O_DIRECT I/O it's simply required..