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=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED 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 11D68C4741F for ; Fri, 25 Sep 2020 18:18:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C2A06208A9 for ; Fri, 25 Sep 2020 18:18:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="XYkZOHpM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729702AbgIYSSx (ORCPT ); Fri, 25 Sep 2020 14:18:53 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:57776 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729121AbgIYSSw (ORCPT ); Fri, 25 Sep 2020 14:18:52 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08PIFQYu146689; Fri, 25 Sep 2020 18:17:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=evq9lxpmdVrNGhpyDrLLtJ0xaHSPH7ecT0Tggiz/xcY=; b=XYkZOHpMBsEETjCSC9cNrHt3zbqM/H0DcqtigZPjjT59Fe54BODdH56einawiC4ADQva 1rbZ7+KQorOf1dzPHMCjMDBjLaPVqLZ+APwtvZFs74ierPUWL6jVbNoyySH7TqR9etHA ayvI7k+VqRkNcBqnM3oqJ0DwyX19MmmZ3UXyGOFUWV9JJstHiNawkZdhw05+sOSdV2S3 vKNKzQDI6aMUKZhVGSoSIrsEgV1jf6jxrdmH7nuyDOltCGB1aPOJ2yURePn8vHN+5Agt hbKW50OS7QRDuMZG/tuQn5XcCU42TSYtM0c6KH0X8ybVk3ooa/bbHlVVhBRbL3uqaznb Qg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 33q5rgwf0r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 25 Sep 2020 18:17:53 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08PIAYNW032000; Fri, 25 Sep 2020 18:17:53 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 33s75k5q3b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Sep 2020 18:17:52 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 08PIHl8q003384; Fri, 25 Sep 2020 18:17:47 GMT Received: from localhost (/10.159.232.106) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 25 Sep 2020 11:17:47 -0700 Date: Fri, 25 Sep 2020 11:17:44 -0700 From: "Darrick J. Wong" To: "Matthew Wilcox (Oracle)" Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , Qian Cai , Brian Foster Subject: Re: [PATCH] iomap: Set all uptodate bits for an Uptodate page Message-ID: <20200925181744.GO7955@magnolia> References: <20200924125608.31231-1-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200924125608.31231-1-willy@infradead.org> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9755 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 spamscore=0 mlxscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009250128 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9755 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 impostorscore=0 clxscore=1015 suspectscore=1 phishscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009250128 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Sep 24, 2020 at 01:56:08PM +0100, Matthew Wilcox (Oracle) wrote: > For filesystems with block size < page size, we need to set all the > per-block uptodate bits if the page was already uptodate at the time > we create the per-block metadata. This can happen if the page is > invalidated (eg by a write to drop_caches) but ultimately not removed > from the page cache. > > This is a data corruption issue as page writeback skips blocks which > are marked !uptodate. > > Fixes: 9dc55f1389f9 ("iomap: add support for sub-pagesize buffered I/O without buffer heads") > Signed-off-by: Matthew Wilcox (Oracle) > Reported-by: Qian Cai > Cc: Brian Foster Makes sense to me, Reviewed-by: Darrick J. Wong --D > --- > fs/iomap/buffered-io.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index 8b6cca7e34e4..8180061b9e16 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -60,6 +60,8 @@ iomap_page_create(struct inode *inode, struct page *page) > iop = kzalloc(struct_size(iop, uptodate, BITS_TO_LONGS(nr_blocks)), > GFP_NOFS | __GFP_NOFAIL); > spin_lock_init(&iop->uptodate_lock); > + if (PageUptodate(page)) > + bitmap_fill(iop->uptodate, nr_blocks); > attach_page_private(page, iop); > return iop; > } > -- > 2.28.0 >