From patchwork Wed Oct 10 00:14:24 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: 10633697 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 13F0C5CAF for ; Wed, 10 Oct 2018 00:14:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0327028FA5 for ; Wed, 10 Oct 2018 00:14:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBE1E28F95; Wed, 10 Oct 2018 00:14:32 +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 8D16A28FE7 for ; Wed, 10 Oct 2018 00:14:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6ED7C6B028D; Tue, 9 Oct 2018 20:14:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 623536B028E; Tue, 9 Oct 2018 20:14:30 -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 49F5A6B028F; Tue, 9 Oct 2018 20:14:30 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 030876B028D for ; Tue, 9 Oct 2018 20:14:30 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id n81-v6so3201409pfi.20 for ; Tue, 09 Oct 2018 17:14:29 -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=PayRx8OK75ABouKsKnUZvYi/e3c7ke7Mg8QRcY/1qfMOtWEqW4WMbRZ28a46CE0cwq UvwrrLt9zM9sg5QQfvdzwPZpvHC2FAhxi3EQ0msdq+uavB6D6BDHWrRDqfOBJJEapD7X 6ZiwAgsGrhqyy5uaQPN3eGkdCOFgc6DmKcX6ssn2SIFKwGQFsJK2R/8pBDgBFIzMDLP3 ThioZ03SUN5I5/Xvie1TwxE0Xj1BvpQU/xkm+NPeL/iREiNDX83D1wSTdOUjuvnLHkr8 N9ndioMW8nuomA58yVXjS9i+YVhzzHgDGvYdWh8nBB+PcxRYoHIsDPnxNsO2Hb2xuf1L uhOg== X-Gm-Message-State: ABuFfogYOJ4G43Ew1ENVCDZe8MCgY02XTngA/Gc72HGwFUXWNmX7DSme dZVQ80u76XsEtzq5p1/tzehB2WyrjQCyDxQHMKog5gOGELeVy3y+RIo3YM/qr64vsixOilG6tSn F2LpMDmqMOKUmEZyrzjk4U6W1z3WyVGUsr4VZRE8BsTC9V0nNvNrt1dwNOu/uHi3hhw== X-Received: by 2002:a17:902:d01:: with SMTP id 1-v6mr31208514plu.88.1539130469687; Tue, 09 Oct 2018 17:14:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV608HQPBM2qRxCw2yhBPe5I5PXbKPkKPl/nlmMdbmkkJZFXMDFNLhiEZTILJ8V7FKHkv0Lly X-Received: by 2002:a17:902:d01:: with SMTP id 1-v6mr31208490plu.88.1539130469128; Tue, 09 Oct 2018 17:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539130469; cv=none; d=google.com; s=arc-20160816; b=zfPS+2hT0tp+IH+A4gtOYyhtI4qjsLHwlZaq5zgzSaNbbDTWfDD61vXjsvHY7I9zkS V4F3WYDSUA3T/tGq2YeeoUwIgQ7E4V2kADrx35AK6rAuOoPc9Itlq35rLMPpY+eNcVF8 TpF7x474dH6opSmLlbDZ6tRccr7IC7ZVtRUvUJOS9w3FTepkKaAaHC52C35TIOw8AHvN jB90Uw4KwPCbPvm6IM4wz4F0wKqSX3RyKfsucNfK9pDPKoxAiWgUsUnodFKre3Q5SS9R wObCHyniw/DLZiXV0wKClLbPLueliiFBEU9jBt6s0lyOSsHR2VKwrtcK81GPE1uj6sPy ZqZw== 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=FmdXR8ZQ5M62cGLU2F62Rdj/f4nIgxOIr2iw9Gd0CwdUwNkGAe15UgoSpMn84818FV k28+iw5Xrqk9+3h2CDF9cj4+CaEzIhOqByanhazrCV/mu0MnwSBUv4ejT5gH5rnZ6Ec3 LP3VJCzyI/Fa627kZXCAkYd679A2Ar22/r58JKmofQe7xj7EgZfpIGvxWEMt8DXFmzrn L4rW38916ivB0tdPdt2Vvrsa1mEur0ggCe+oERMaH5FHJpp+t395+BzXIyNk47OSgB+y 0WyAY4wqo2LwzR+zzcY45b7v7bVib1ueE81rdXvMxIr9FsbZQb96M/WNYyiV0LrVtY6b MGqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="m6/DWy2J"; 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 a15-v6si22635039plm.216.2018.10.09.17.14.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 17:14:29 -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="m6/DWy2J"; 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 w9A0DduV141873; Wed, 10 Oct 2018 00:14:28 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=m6/DWy2JYP34yF2sN/7OOy2mlIFl0E/btCWrbcKqPuBa3anUDHZINMahnTMTwQeb1WjP 0ACpWRrGPbps6hlVyJUJPTGLvouwslGl8eUv9vboKMBkACZ/LDWHxkiq0ZBmCLcHUDLF 8FV56ha+UtSRGNfGnRUkPVzQw5k7wEosue48V+dQ+luSZ9lW2BdclQZ2dWUpGBi9aikt 8s0msKvCQ2cWoelmXZJilouF94fv7FhiP8X6JGeEspzVVKo+XiTXxkYkM4JJe6rkSUYC z1+Isxkp2uYujpd8LFNvGYODG1cWt3DBUowxFBbF7rZYdwN7uh8xF3emxqLXNcXvlTIF OA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2mxn0q0ttp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Oct 2018 00:14:28 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9A0ERc9006021 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Oct 2018 00:14:27 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9A0EQGI004266; Wed, 10 Oct 2018 00:14:26 GMT Received: from localhost (/10.159.249.114) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 10 Oct 2018 00:14:26 +0000 Subject: [PATCH 21/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: Tue, 09 Oct 2018 17:14:24 -0700 Message-ID: <153913046462.32295.3245494254410288586.stgit@magnolia> In-Reply-To: <153913023835.32295.13962696655740190941.stgit@magnolia> References: <153913023835.32295.13962696655740190941.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9041 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=784 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810100001 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);