From patchwork Wed Oct 17 22:45:31 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: 10646291 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 3044015E2 for ; Wed, 17 Oct 2018 22:45:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20E88288C7 for ; Wed, 17 Oct 2018 22:45:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 157C5288E7; Wed, 17 Oct 2018 22:45:39 +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 7F785288C7 for ; Wed, 17 Oct 2018 22:45:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43DF76B027D; Wed, 17 Oct 2018 18:45:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3EE456B027E; Wed, 17 Oct 2018 18:45:36 -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 2B6E76B027F; Wed, 17 Oct 2018 18:45:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by kanga.kvack.org (Postfix) with ESMTP id E98226B027D for ; Wed, 17 Oct 2018 18:45:35 -0400 (EDT) Received: by mail-yb1-f198.google.com with SMTP id z8-v6so15653150ybo.17 for ; Wed, 17 Oct 2018 15:45:35 -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=OAmrVIXZc2CEqsPGpMLoE9bdmYA/ls2wwpsz5LDZp+Q=; b=UJgqzbUjDSLrtnijTb6TOSJm2dbNNQgAtdgquBdnVBABBWrahBN60iD4/BeEgIgoeI kqSXYBHlouTx6C5z6BXCPMmrtRPdb5FiZBsGYlnTbkrgvWRdl7WRfa5sLmzSen9JAQLm 352h7nnkQRQWau1DPO6j81W5R4GJaksJafoC/heQZVBlKNFTeo9JwXkopJt6g4DON1BZ w8U/ZRG3odu0LQJTZl9WOiCdc0xyUrV28F7wkLA296w2Sijsbciy3FARJT6n6OOTdYGz OIvWLmeav4k6KkTZ7tUqK9whka3kciGj3BFnd+FX+w/2SNOdcYEfLtui6hQSdkWIoSL+ ferg== X-Gm-Message-State: ABuFfoiOj1YD+NpPncEy7A8EpytRtLKtu2hzvhsWoGEs/zvKkLQIegFX Pe2SKnyyHddCPhN3xubUlxWeCtO7H1M8Z9lQRYfkJydLxI56400w0LJE/BAJ5QVhkly+AQo4Amo SWyyKdEgG6bIWtDkscvT/HWqMrIEXSxI0x3tl247TUkIO6H7eNaf6LNOlw+HoMnfjfA== X-Received: by 2002:a0d:e18c:: with SMTP id k134-v6mr15705354ywe.314.1539816335709; Wed, 17 Oct 2018 15:45:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV60WieTiKuFsfk+Cs2LeHmc/AjdV7kcCgggbFtu2zc8XO9E36KoWUkfKLxTYsYufj5T9bJOe X-Received: by 2002:a0d:e18c:: with SMTP id k134-v6mr15705333ywe.314.1539816335131; Wed, 17 Oct 2018 15:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539816335; cv=none; d=google.com; s=arc-20160816; b=FL4F4JziwUYHX8ZOjsR+sv1f5h8yPFaCzhoHd9nF9OqkAolWvEW8P35WF71tu7nUe1 ccYDKLgXvsedHDee7kqz4xOMaSULtnmP/4UVS2cYVgnU10/b3krvCZPP6BcCNgiAWyuv Zho4P4cj2w4vMQINxztYAqlMkgOgdeH07NLERnkDNIQUDvqUZ1+8H1lAcah/ytpnCJSG jNZ4uS+4KPSTUcmnPgZBZDjLOoaK2OuqTqg9r27T05JxIsRObAiTHAGVi4YD12eOsX6u pwtAXMnebfviDL5AHsWJmq336r1IYOXjMn8hcm2PzkW6Ju8ZJ64p0EIehCK1OPW5LUg0 gPWA== 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=OAmrVIXZc2CEqsPGpMLoE9bdmYA/ls2wwpsz5LDZp+Q=; b=W+qY2c71bTDQWDznnqIx01hXQL3eHrfKeaT7d76PGVgOqv57S3FPGNd+4JN+D49HLR 7uvDxu8eGwh89wpejPm/Tce0iWt1b9acqGXoVTZ+QqUyjWJtsODC/8Yh+6c9bZ22pi1G TM33iXuVN1SK4x4JTnUwXIOa3zE11R6/CLmARYSy2tvtl+f3FhorkIxaaF8nT80/d9s6 WNPCWdX0SnRbPblE3vGIC2Z1j84xSVRT+vJyMLegCwtrx2RIR9DTUH2pdDZoTlgcoU93 hfInTA2tZBO9tyB726mUokfTUqCRq+8Q2vkzFxziTbsUxtQsPH/o9pi/tYgC7y9Obqy7 rJpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=d5+Xdicg; 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 o5-v6si6934269ywf.320.2018.10.17.15.45.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 15:45:35 -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=d5+Xdicg; 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 w9HMhuI5048513; Wed, 17 Oct 2018 22:45:33 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=OAmrVIXZc2CEqsPGpMLoE9bdmYA/ls2wwpsz5LDZp+Q=; b=d5+XdicglkEpvelN18WVtSxT6qcC7XHaFMI2C+b89CIH3Wq3CHUMaC4sDRMTpiz4BERT DoYQWCNgwdLyaduBojLLKnw9sSb4Z6o1qyY2K2hqcGJ7L9jbGa3vXTrjJRFNXEeSAT2A kQ4WY9Gj/rx9T8Z5qhWcR9RqZz0uAHXV7uYzVL7r6x4AnZPaprqvhOhtF93cGuP4PEeL pUyM0h5qM7Wy1gF9xU53MjDUgNaGjxOtivA9tEP+t76WTerpu0dp5fTkKOBhNXHr6ZDJ 4d2Hx7ikrnLjN9Hkz6NDuH1U2kNuMhkbjwKEpTo5BpJfgGlvbGpAYqvReEHhVX+L5zhU qQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2n38nq9sup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:45:33 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9HMjXf4003259 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:45:33 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9HMjX4D014965; Wed, 17 Oct 2018 22:45:33 GMT Received: from localhost (/10.159.132.177) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 17 Oct 2018 15:45:32 -0700 Subject: [PATCH 11/29] vfs: pass remap flags to generic_remap_checks 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, Amir Goldstein , linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , ocfs2-devel@oss.oracle.com Date: Wed, 17 Oct 2018 15:45:31 -0700 Message-ID: <153981633108.5568.15177882405104151982.stgit@magnolia> In-Reply-To: <153981625504.5568.2708520119290577378.stgit@magnolia> References: <153981625504.5568.2708520119290577378.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9049 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=503 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810170188 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 Pass the same remap flags to generic_remap_checks for consistency. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein Reviewed-by: Christoph Hellwig --- fs/read_write.c | 2 +- include/linux/fs.h | 2 +- mm/filemap.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/read_write.c b/fs/read_write.c index 201381689284..ebcbfc4f2907 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1782,7 +1782,7 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, /* Check that we don't violate system file offset limits. */ ret = generic_remap_checks(file_in, pos_in, file_out, pos_out, len, - (remap_flags & REMAP_FILE_DEDUP)); + remap_flags); if (ret) return ret; diff --git a/include/linux/fs.h b/include/linux/fs.h index ecdfcb8b15ff..c3e807f1f022 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2981,7 +2981,7 @@ extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *); extern int generic_remap_checks(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, - uint64_t *count, bool is_dedupe); + uint64_t *count, unsigned int remap_flags); extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); diff --git a/mm/filemap.c b/mm/filemap.c index 08ad210fee49..b0f1f6d93d9c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3001,7 +3001,7 @@ EXPORT_SYMBOL(generic_write_checks); */ int generic_remap_checks(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, - uint64_t *req_count, bool is_dedupe) + uint64_t *req_count, unsigned int remap_flags) { struct inode *inode_in = file_in->f_mapping->host; struct inode *inode_out = file_out->f_mapping->host; @@ -3023,7 +3023,7 @@ int generic_remap_checks(struct file *file_in, loff_t pos_in, size_out = i_size_read(inode_out); /* Dedupe requires both ranges to be within EOF. */ - if (is_dedupe && + if ((remap_flags & REMAP_FILE_DEDUP) && (pos_in >= size_in || pos_in + count > size_in || pos_out >= size_out || pos_out + count > size_out)) return -EINVAL;