From patchwork Thu Oct 11 04:14:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10635965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C7DCB14DB for ; Thu, 11 Oct 2018 04:15:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABF492787C for ; Thu, 11 Oct 2018 04:15:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DAFC2A651; Thu, 11 Oct 2018 04:15:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38B662787C for ; Thu, 11 Oct 2018 04:15:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38D6A6B0291; Thu, 11 Oct 2018 00:14:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2C4A56B0293; Thu, 11 Oct 2018 00:14:58 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E8F86B0294; Thu, 11 Oct 2018 00:14:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by kanga.kvack.org (Postfix) with ESMTP id D6F176B0291 for ; Thu, 11 Oct 2018 00:14:57 -0400 (EDT) Received: by mail-qt1-f200.google.com with SMTP id q6-v6so7525792qtb.14 for ; Wed, 10 Oct 2018 21:14:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:subject:from:to:cc:date :message-id:in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=dIxJEPGoGcvBJJu/MvYn4xLmNP7rYi1FOse/8BNxuhM=; b=JYo5XfUoSdmrO4aplsd0OfBFlzyg2Va/WN/KxQZR3zyxvYtbR957Moe6l1pdSAkTne +/V3q1uEU47TAudWGr1rNL8U1sofZiocqzb9vU5wLOw2QkmRIQRWqyLA8zDZp+Yt9bYF EL4lIxuFNs/IOBG/Fymit8vudMYux3Xfi6X0T21hfcBLCNWEHnEkb2WP7AZvbsGWK5Me z4UZLQR7wpqL+FBa5Hwz6wGUbhpjepRJH2DP8oDw7VUDG1ziz9hYAN8zbUbUkvKt5bk0 mdLAENjpQnl834y9eu6AO9e+Q7h25FbdOK3RHFsOCsNyS2simZTo/WNj8B7FLi/rQv1P QoWQ== X-Gm-Message-State: ABuFfohyZlehvVTBZeUbOfQP7FhBSF7Kzs/WgpLeZXp80AeJXfvMajCw EAFQd7La3MUtRGO5UeFp8Yfrm1OpwKishtZZU3le78EUDQADSvYo4iKabEWNxcyhM4ScSZ1DDJM XE2EQXZafinJGDiB9ieR818ca9E0doH+TZcHPoZMRtBaDuOJJBtY+4Xh3RNc54ENnqA== X-Received: by 2002:a37:6d41:: with SMTP id i62-v6mr29755889qkc.237.1539231297602; Wed, 10 Oct 2018 21:14:57 -0700 (PDT) X-Google-Smtp-Source: ACcGV60op91TqlhtTFMr2Ao7yA4uku+TE4bZdk0qAbxXmWsiqyYFgfuzkdVLBk6HsAnRl36y9sK/ X-Received: by 2002:a37:6d41:: with SMTP id i62-v6mr29755868qkc.237.1539231297140; Wed, 10 Oct 2018 21:14:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539231297; cv=none; d=google.com; s=arc-20160816; b=09CRSc6c8gb6LsWOfrQdsi6IGF0c25/Py1HeGVIKKNaNLHBUvXnRggacicJHuWDhg6 lIikX43fWugnIu/bpFx0BLdSu+5yUYl6QP7WEesLI3OO5EmOrNyOT9Y2br87neT+BTKK VZOOBxdngmV3MlYfZYJ1+lck+2aavWhHEvMa8Ces2hlGP142n+Jz95BxYBJnYDjvcKp0 8fiST78viNOxGZskXnIbw81oPgWwkIqLlreAIwwVY1dQ4V1jQdESC6qSib/98wdp9wnL F2sKM7vBUCFf65wTNqNjsW1kpXfTme5qL2qvlQjT3okanBxFk1sgwoYUc3ag3EA2IMhu jukw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:dkim-signature; bh=dIxJEPGoGcvBJJu/MvYn4xLmNP7rYi1FOse/8BNxuhM=; b=Ih2utQdq3mfN0pf1xIXoq0DQ0gpSwYxcRF5ekitN6zappa49+Bb3cvrx7055A5F6tz GYy5brDNogrOI8TYmohJDoKtfdlt2C1uMVezbpxUkjw+2B7npknrSpQKn/QdZah1oWY6 +/Jq3mvxNRgBwllRXtieeVRVlZPty/OiUFPBn9G9ykLHXE8cdeVNm/JmWusDDE42gCiF 4J/Jrc/gB4b97jmB+slSGsM00+n4ROPGtMiV527Z80aoMEn4g+sZncHuw6hhvS9C3VBc 7pprRQjBzx+sbbeMtn6vvo+UmcfE9vqSOLDH/8gMsY3lWiw5nnHRXWRAGlD1SshNvzYI T/DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=xGaN7Sot; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from aserp2120.oracle.com (aserp2120.oracle.com. [141.146.126.78]) by mx.google.com with ESMTPS id v2-v6si4722246qth.252.2018.10.10.21.14.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 21:14:57 -0700 (PDT) Received-SPF: pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) client-ip=141.146.126.78; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=xGaN7Sot; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9B4DtIa058441; Thu, 11 Oct 2018 04:14:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=dIxJEPGoGcvBJJu/MvYn4xLmNP7rYi1FOse/8BNxuhM=; b=xGaN7Sot9eJSZUxta0zU0Bt60mUrF03IKbyv2HZJwdYA7pKV14F89yvoC4tavXoDMgPA odiZSHJ3IBy64p+JAuSqLitC0xWewGehvj5ai3rkrfgtegXoXXaUZviPAn1+73vK132N QAmFcU1Yqoh4XHJo3mp+bz7L9oL7tswxdm1eHCy3M34fAP8QYfm0yfuh4YObUvHhfqKz q5CwuOdGlTm7PIwEr9ElYoigY8lEMGV1dY3snvwXYUuzWoXAGOlT1jCQ5FL6tf+1fFvZ 8qxyzM+owOYcf2xYCPolmEW+HcnFbPqkaFG4PUCQ6voTjPB9C8hhh4/q1Ol55wN4hfjJ gg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2mxn0q9e2t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:14:56 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9B4EsWi008174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:14:54 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9B4Es1k009726; Thu, 11 Oct 2018 04:14:54 GMT Received: from localhost (/10.159.132.249) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 11 Oct 2018 04:14:53 +0000 Subject: [PATCH 20/25] ocfs2: truncate page cache for clone destination file before remapping From: "Darrick J. Wong" To: david@fromorbit.com, darrick.wong@oracle.com Cc: sandeen@redhat.com, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, ocfs2-devel@oss.oracle.com Date: Wed, 10 Oct 2018 21:14:52 -0700 Message-ID: <153923129210.5546.9940179804812552182.stgit@magnolia> In-Reply-To: <153923113649.5546.9840926895953408273.stgit@magnolia> References: <153923113649.5546.9840926895953408273.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9042 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=800 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810110040 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: X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong When cloning blocks into another file, truncate the page cache before we start remapping blocks so that concurrent reads wait for us to finish. Signed-off-by: Darrick J. Wong --- fs/ocfs2/refcounttree.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index a3df118bf3b9..851ba3ae7ce8 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c @@ -4869,14 +4869,12 @@ int ocfs2_reflink_remap_range(struct file *file_in, down_write_nested(&OCFS2_I(inode_out)->ip_alloc_sem, SINGLE_DEPTH_NESTING); - ret = ocfs2_reflink_remap_blocks(inode_in, in_bh, pos_in, inode_out, - out_bh, pos_out, len); - /* Zap any page cache for the destination file's range. */ - if (!ret) - truncate_inode_pages_range(&inode_out->i_data, pos_out, - PAGE_ALIGN(pos_out + len) - 1); + truncate_inode_pages_range(&inode_out->i_data, pos_out, + PAGE_ALIGN(pos_out + len) - 1); + ret = ocfs2_reflink_remap_blocks(inode_in, in_bh, pos_in, inode_out, + out_bh, pos_out, len); up_write(&OCFS2_I(inode_in)->ip_alloc_sem); if (!same_inode) up_write(&OCFS2_I(inode_out)->ip_alloc_sem);