From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A495C433E2 for ; Mon, 7 Sep 2020 09:00:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E1E28208C7 for ; Mon, 7 Sep 2020 09:00:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1E28208C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5A4768E0001; Mon, 7 Sep 2020 05:00:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 57A376B0070; Mon, 7 Sep 2020 05:00:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4699E8E0001; Mon, 7 Sep 2020 05:00:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 30F306B006E for ; Mon, 7 Sep 2020 05:00:40 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E7BDC180AD81A for ; Mon, 7 Sep 2020 09:00:39 +0000 (UTC) X-FDA: 77235669798.15.sheet71_0515cb6270ca Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id AF01B1814B0C8 for ; Mon, 7 Sep 2020 09:00:39 +0000 (UTC) X-HE-Tag: sheet71_0515cb6270ca X-Filterd-Recvd-Size: 4084 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 7 Sep 2020 09:00:39 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DC6C6AD56; Mon, 7 Sep 2020 09:00:38 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id E3FFA1E12D1; Mon, 7 Sep 2020 11:00:37 +0200 (CEST) Date: Mon, 7 Sep 2020 11:00:37 +0200 From: Jan Kara To: Mikulas Patocka Cc: Linus Torvalds , Jan Kara , "Darrick J. Wong" , Dave Chinner , Jann Horn , Christoph Hellwig , Oleg Nesterov , Kirill Shutemov , Theodore Ts'o , Andrea Arcangeli , Matthew Wilcox , Andrew Morton , Dan Williams , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH 1/2] ext2: don't update mtime on COW faults Message-ID: <20200907090037.GB16559@quack2.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: AF01B1814B0C8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat 05-09-20 08:12:01, Mikulas Patocka wrote: > When running in a dax mode, if the user maps a page with MAP_PRIVATE and > PROT_WRITE, the ext2 filesystem would incorrectly update ctime and mtime > when the user hits a COW fault. > > This breaks building of the Linux kernel. > How to reproduce: > 1. extract the Linux kernel tree on dax-mounted ext2 filesystem > 2. run make clean > 3. run make -j12 > 4. run make -j12 > - at step 4, make would incorrectly rebuild the whole kernel (although it > was already built in step 3). > > The reason for the breakage is that almost all object files depend on > objtool. When we run objtool, it takes COW page fault on its .data > section, and these faults will incorrectly update the timestamp of the > objtool binary. The updated timestamp causes make to rebuild the whole > tree. > > Signed-off-by: Mikulas Patocka > Cc: stable@vger.kernel.org Thanks. Good spotting! Linus has already merged this so nothing more to do here. Honza > > --- > fs/ext2/file.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > Index: linux-2.6/fs/ext2/file.c > =================================================================== > --- linux-2.6.orig/fs/ext2/file.c 2020-09-05 10:01:41.000000000 +0200 > +++ linux-2.6/fs/ext2/file.c 2020-09-05 13:09:50.000000000 +0200 > @@ -93,8 +93,10 @@ static vm_fault_t ext2_dax_fault(struct > struct inode *inode = file_inode(vmf->vma->vm_file); > struct ext2_inode_info *ei = EXT2_I(inode); > vm_fault_t ret; > + bool write = (vmf->flags & FAULT_FLAG_WRITE) && > + (vmf->vma->vm_flags & VM_SHARED); > > - if (vmf->flags & FAULT_FLAG_WRITE) { > + if (write) { > sb_start_pagefault(inode->i_sb); > file_update_time(vmf->vma->vm_file); > } > @@ -103,7 +105,7 @@ static vm_fault_t ext2_dax_fault(struct > ret = dax_iomap_fault(vmf, PE_SIZE_PTE, NULL, NULL, &ext2_iomap_ops); > > up_read(&ei->dax_sem); > - if (vmf->flags & FAULT_FLAG_WRITE) > + if (write) > sb_end_pagefault(inode->i_sb); > return ret; > } > -- Jan Kara SUSE Labs, CR