From patchwork Sat Oct 13 00:08:04 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: 10639669 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 4A5571869 for ; Sat, 13 Oct 2018 00:08:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3146A2860A for ; Sat, 13 Oct 2018 00:08:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20D702916C; Sat, 13 Oct 2018 00:08:12 +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 9E1B527FAC for ; Sat, 13 Oct 2018 00:08:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0FDBE6B0288; Fri, 12 Oct 2018 20:08:10 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0AFA36B028A; Fri, 12 Oct 2018 20:08:10 -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 F08166B028B; Fri, 12 Oct 2018 20:08:09 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id AFD506B028A for ; Fri, 12 Oct 2018 20:08:09 -0400 (EDT) Received: by mail-pg1-f197.google.com with SMTP id x2-v6so10434778pgr.8 for ; Fri, 12 Oct 2018 17:08:09 -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=CxIvvJVOCNB/FgDA3oYz6gcDYDmG4t0jQSPErwTjmu7xrlQNWZfFcp5zcAULLoNekP sjP2cSxnmbvOXxTLTaSA5MoSDVAk9F5fFlJG7xlXAQ3ROXR9FjmXRULdRMSZ0yYirH1t naP5OYOpXhoNgjfWomv0r46x5PxQ+VV6yLGiH0DF7bIr0IEYS1Dx3ytQgRvYEpWunIgE ttURCRGKmIrKKSIASKlR03aFABjYVfPfxNRgpDwYXFxDl9edq7S+fh4Vh+AEX/evV8uJ JoW5a//mZhqrIRZ0W0fcRwGGEs388CPf4FpFhPtneZkL+gQdSvJ+WwOFYE/zWZmvfvlT 0Y8w== X-Gm-Message-State: ABuFfohIKKpHLWs7TSx1dtXZ5zkQ7aWSeVe1jPK4C0GU+EBu0V76X4VS pdQiXm1r10F4+zDsFkbw41Poh87+0rq7f6anUs1FUXvxQvpp9860ZUIJJsbEZ8hFnvu/LrtbcfW moJxr3OvCxyzvq16sjcMCVf57WpG72MCH7fWux1xacNJO/eiZ0ZG5ywS8s8NdXbyDTA== X-Received: by 2002:a63:e645:: with SMTP id p5-v6mr7120149pgj.218.1539389289401; Fri, 12 Oct 2018 17:08:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV63m+QU2klSCwfkyH3t3NvUINUGKsSsE4YsFHgrNz9eyDdzu5/7oTiUL4Vyk3mV2KPw6yY2I X-Received: by 2002:a63:e645:: with SMTP id p5-v6mr7120122pgj.218.1539389288838; Fri, 12 Oct 2018 17:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539389288; cv=none; d=google.com; s=arc-20160816; b=dtW6fs4Nmxvi+wCqnD2S7CRQAzQWtsIQ6FP/YkBDI9i4E0Ei2rMq7AG3rInMMn8mGD c5WU1/u7DFFIlHSTAaiYBJaKNmjXOoWJuLhdnCLzvIWtN+bjvbuLhdUkYTA2ZaqZ8W6q L1dWO2fd6+dUxTcvQOzSEOBBZRDYL7GnKhpMoyPSkcYX4IIMzpVOGHehDxhZNHE+lWPO RPGmE0XpMn95KNqC9BRnYSHOrQ6YDMbdTfIuz2fQdri81i6NHKLmI7/HjnKh3eeBv5h4 q0Uh79N2F3eAerf2SU84q/jJZ8DiyBOK9VsD2/aqUziJIgHm99RAMeBL95sW5hY3X88l WriQ== 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=R2JSZcNADWgD4NaDBVYfiiwoe3dNh8648vrukoGJ9M8i8Tljtrjchyb/9gUyOyUZmj c/qI7SwiEUqSkE5FHlz39pwDI/FBcBPIdDZZUmweAO6Z3DF/ZeeuS+FfVDS0RW3cgezL TDJbYs7dBMGM5ZisVPYeFrU+/XziP6GDI3rwMmn8hzc1MUvaNfjti9BWVepj29TpbA2T qsv/1U65GP73UbGJXtoB/+CnveeOkQZLU09SGMZk8FuHnxP3FrK/0a1dLCixr2l/7mrn s/n708CwR3a3nOyiVI/PQQosiTHcBX+reecobGXOPzBhA32DJ6/qKdrti05Mld4KrlRW 1FOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="V/VIXGDJ"; spf=pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.85 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2120.oracle.com (userp2120.oracle.com. [156.151.31.85]) by mx.google.com with ESMTPS id q85-v6si2969997pfq.32.2018.10.12.17.08.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 17:08:08 -0700 (PDT) Received-SPF: pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.85 as permitted sender) client-ip=156.151.31.85; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="V/VIXGDJ"; spf=pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.85 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 (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9D04cFQ105128; Sat, 13 Oct 2018 00:08:08 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=V/VIXGDJnBi/VoOavIDBKtXa5moipWtWRr0LdMCPHyEt1+dRJdoL+EN0u/bLaAJnpWha lplN+Cra/xDZ9AIihaEc9aHq8/KNTXT8rOCKndrLUz8g+k8wcIcQHYMj/j+KedycTfvy W5X1Mdn7aW5XLXAzc72oKUjQfl2I6yR8Z2FnEnZis6W2EGEnM0hmqZGYDyjDBJmsFghX 3yfMo828AaBzrxZwidiB6Vfhk+AEgb0VpMCqoTyxxwo4rFhBZngg+kKFWGXy3QXdJH90 YwDvlp6ERQBIVqjLJxqvk5ObnZdM4TqRptM8b+6br3pg8unRD2L57WXUnhbtjbPXIPs+ og== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2mxnprnfm1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:08:07 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9D0876O020995 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:08:07 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9D086dq018479; Sat, 13 Oct 2018 00:08:06 GMT Received: from localhost (/10.159.251.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 13 Oct 2018 00:08:06 +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: Fri, 12 Oct 2018 17:08:04 -0700 Message-ID: <153938928467.8361.17081308150390428656.stgit@magnolia> In-Reply-To: <153938912912.8361.13446310416406388958.stgit@magnolia> References: <153938912912.8361.13446310416406388958.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9044 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=801 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810130000 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);