From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com ([192.55.52.115]:39434 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932212AbcBAVMb (ORCPT ); Mon, 1 Feb 2016 16:12:31 -0500 Date: Mon, 1 Feb 2016 14:12:24 -0700 From: Ross Zwisler To: "Wilcox, Matthew R" Cc: Jared Hulbert , "linux-fsdevel@vger.kernel.org" , "ross.zwisler@linux.intel.com" Subject: Re: bug in COW no page fault? Message-ID: <20160201211224.GA21755@linux.intel.com> References: <56ABDBC7.5030703@gmail.com> <100D68C7BA14664A8938383216E40DE04217F70D@FMSMSX114.amr.corp.intel.com> <100D68C7BA14664A8938383216E40DE04217F75A@FMSMSX114.amr.corp.intel.com> <100D68C7BA14664A8938383216E40DE04217F8A5@FMSMSX114.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <100D68C7BA14664A8938383216E40DE04217F8A5@FMSMSX114.amr.corp.intel.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sat, Jan 30, 2016 at 05:47:18AM +0000, Wilcox, Matthew R wrote: > I remembered that Ross had a similar question, so it must be hard to understand. How does this comment work for both of you? > > + /* > + * A truncate must remove COWs of pages that are removed > + * from the file. If we have a struct page, the normal > + * page lock mechanism prevents truncate from missing the > + * COWed page. If not, the i_mmap_lock can provide the > + * same guarantee. It is dropped by the caller after the > + * page is safely in the page tables. > + */ Yep, this makes sense. It may be worthwhile to explicitly say "It is dropped by do_cow_fault() after the page is safely in the page tables." so the less experienced among us (me) can easily find the match to the i_mmap_lock_read().