From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: [PATCH v7 06/22] Replace XIP read and write with DAX I/O Date: Wed, 9 Apr 2014 14:04:37 +0200 Message-ID: <20140409120437.GA7715@quack.suse.cz> References: <3ebe329d8713f7db4c105021a845316a47a29797.1395591795.git.matthew.r.wilcox@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, willy@linux.intel.com To: Matthew Wilcox Return-path: Content-Disposition: inline In-Reply-To: <3ebe329d8713f7db4c105021a845316a47a29797.1395591795.git.matthew.r.wilcox@intel.com> Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org I've noticed one more thing here: On Sun 23-03-14 15:08:32, Matthew Wilcox wrote: .... > +ssize_t dax_do_io(int rw, struct kiocb *iocb, struct inode *inode, > + const struct iovec *iov, loff_t offset, unsigned nr_segs, > + get_block_t get_block, dio_iodone_t end_io, int flags) > +{ ... > + retval = dax_io(rw, inode, iov, offset, end, get_block, &bh); > + > + if ((flags & DIO_LOCKING) && (rw == READ)) > + mutex_unlock(&inode->i_mutex); > + > + inode_dio_done(inode); > + > + if ((retval > 0) && end_io) > + end_io(iocb, offset, retval, bh.b_private); In direct IO code, we first call end_io() callback and do inode_dio_done() only after that. Since filesystems use i_dio_count for protecting against different races, calling end_io() after inode_dio_done() can open all sorts of subtle races. Honza -- Jan Kara SUSE Labs, CR -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org