Return-Path: Received: from mx2.suse.de ([195.135.220.15]:40020 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965838AbcA1MsY (ORCPT ); Thu, 28 Jan 2016 07:48:24 -0500 Date: Thu, 28 Jan 2016 13:48:31 +0100 From: Jan Kara To: Matthew Wilcox Cc: Jan Kara , Dave Chinner , Ross Zwisler , Matthew Wilcox , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 0/2] Fix dax races between page faults RFC only Message-ID: <20160128124831.GG7726@quack.suse.cz> References: <1453867708-3999-1-git-send-email-matthew.r.wilcox@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453867708-3999-1-git-send-email-matthew.r.wilcox@intel.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue 26-01-16 23:08:26, Matthew Wilcox wrote: > From: Matthew Wilcox > > I haven't had time to boot these patches yet, much less split them apart > into properly reviewable chunks. I just wanted to get the current state > of my tree out before Dave & Jan wake up. > > The first patch you've seen before; it was patch 2/8 in the PUD patch > series I posted on January 6th. It seemed like a good place to start > since it unifies a lot of fault handling. > > The second patch is everything else we've talked about rolled into one. > It looks pretty good to me; after I make sure that it boots and passes > some smoke tests, I'll add the optimisation Jan & I discussed today > about trying to reduce the times we have to take the allocation lock in > exclusive/write mode. > > If I understand the current state of the code correctly, truncate can't > race with the fault handler, so the re-checks we do of i_size are now > dead code, which can be deleted. right? Those i_size checks are still needed. You are right that the locking protects DAX code to run in parallel to truncate but truncate may happen after we look at VMA & PTE and before we grab appropriate fs lock in the fault handler. So if we didn't check for i_size under the lock, we risk that we would e.g. ask the filesystem to allocate blocks beyond EOF and those blocks would never be truncated. The fault itself will be fine since once we return from the fault handler, we'll notice the PTE changed and retry the fault but those dangling FS blocks would we be bad. Honza -- Jan Kara SUSE Labs, CR