From patchwork Sat Oct 13 00:07:05 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: 10639559 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 E7F331869 for ; Sat, 13 Oct 2018 00:07:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5DBF2B78F for ; Sat, 13 Oct 2018 00:07:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA3B42B79F; Sat, 13 Oct 2018 00:07:18 +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 8F2522B78F for ; Sat, 13 Oct 2018 00:07:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5935E6B0276; Fri, 12 Oct 2018 20:07:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 544B56B0277; Fri, 12 Oct 2018 20:07:16 -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 45A856B0278; Fri, 12 Oct 2018 20:07:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by kanga.kvack.org (Postfix) with ESMTP id 1BB6D6B0276 for ; Fri, 12 Oct 2018 20:07:16 -0400 (EDT) Received: by mail-qt1-f197.google.com with SMTP id j63-v6so3331118qte.13 for ; Fri, 12 Oct 2018 17:07:16 -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=liANWFsEK8bSCnqtpTXhPB44DP7Pns+fSB/icXEuWpA=; b=ehHjj0sDdYgPztV1NNQq2K5ze2E2s9kpHCzn07uDtDr9mX/7qK8qsdPhrpc2f9jSpw Ixf6+q3lDGg6FwXrU4Hrl5GhB756C5S5y/zvYF49eNtwUuSkeUQ2TqFx4m503RS1KAIJ GoFLA0c6JgsFqGpawgu8FwvghhpLY+tBOtN0bKqEavTIokECQlZuEwG2YrXQWBtVJMly naMW+jx7xeo7iDs1AgB9pCaHk3WvswgoHkEl3Pt1G89Wfe+R8oLlq/NT7ZBZcqGGWhGe V8IV0e71M5rnUwoQHLtM39nTmrbADsza1tLQxC3QXiAEX9ynqiZCtNqqQUZmdajmmcaX 33tQ== X-Gm-Message-State: ABuFfoh4elW5SCQdqMgPzRPDq1WifMYYFwpsbbjl8brhm/ytv/CS0gKt 5bKUsOxziLCJFowzft05s3UBoDGbTxw+9cwtnkWVrNvUvX5ODaOO1VboLA1etTmJQCybqebwB1N hTLZJ6mr58D5u36jua+sDRiRSJiL5DpE2hHrpRxyHy7nmMny/r8V5t8gVnTVRfxrEuw== X-Received: by 2002:ac8:3059:: with SMTP id g25-v6mr7959689qte.136.1539389235898; Fri, 12 Oct 2018 17:07:15 -0700 (PDT) X-Google-Smtp-Source: ACcGV601dnCMsCGt9A1/JleWZMhFBNSqhk5Fd7FfeQ4rb+JenR1/3IE4Rgo5FLxXc8yulHCZhjfM X-Received: by 2002:ac8:3059:: with SMTP id g25-v6mr7959672qte.136.1539389235402; Fri, 12 Oct 2018 17:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539389235; cv=none; d=google.com; s=arc-20160816; b=OEebYNf9kch9cAwyCUmEApgey2cq82u/mZ+WjU5IQcFYQ5j02HzhdOVIralN01AtRh bil9DNpfgSCKlwyl8Kt483WVYFm1cMsnpGFkWcQJGRt3s/H6qBCcjzFX8fvN9WFBNfCV B6ePTGl0hKBt0v95X8sIPby5Y8mJ2qjPoWaE//gSg38fcWnGdPNxX8Gk2ZglZ24MRHWB DWzTgw5ClsfgegH348z2xZEs/fm8F0KDnI6cPejArGFXv3t89ewHgVG3zjU1YzVK+q/m 1AZCUOAqB/tINJt8hfp99+hcVY3kzqjbqS5v+cN8L3AnWhfYY2WD4p4epvrxmkV589Ha q5mA== 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=liANWFsEK8bSCnqtpTXhPB44DP7Pns+fSB/icXEuWpA=; b=Cz0nJidb6WH81PF7nWruESqI3+hFQgQStWiZ/0Xms8XBgfequxroIjrnWWvDF/TbJP am98yvaekCxVhzaNkxRzM7LqCtXcFso0xNIQwtZQH7PvKfda9bSf/kXXTdLzviHYh2s3 ZhpT2TwDeCCOaTqGeMVSv4F+IjVUJbHv8jGtwA6o9zt+WCKiaC0dVQqhkzB2JAqC1KDt ni7CYnhGorcqF1R7fNV6pySRhfZIIe6oNA9xoa07xw0GxqfITDDjLH9AWgiqKF+Enizq CESeR5/a76KurSfEjdHv1qKbStRkgRqM95PHFyDXKgPXe2HjHpxaG4Dp5A8UTKUmclQP 9VOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=qOF9nR0m; spf=pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2130.oracle.com (userp2130.oracle.com. [156.151.31.86]) by mx.google.com with ESMTPS id p17si2213527qvo.148.2018.10.12.17.07.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 17:07:15 -0700 (PDT) Received-SPF: pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.86 as permitted sender) client-ip=156.151.31.86; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=qOF9nR0m; spf=pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.86 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 (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9D03wHO143579; Sat, 13 Oct 2018 00:07:13 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=liANWFsEK8bSCnqtpTXhPB44DP7Pns+fSB/icXEuWpA=; b=qOF9nR0mgPn378Uexa1RHMsL8hPbDDAxY+OkAUJcG74u6Xz/AAE4YHu7X/xfCnzfHmm5 nXp6kksaAhOsPy0QA27UkuM55kD9gVu3BOfCuvSq53BYM6rVBFPS+JV22Ut4ZJwmF1oN 3zq1TpT6LYSgzF3xhBcomgR4wZtTml9LnXjzTgIzy27zurp5RRWUvhbB6jMrRsoRS4p8 QcgGUXkCy3Vlpa+t2it/1wQCp6vl41Ldl3+mI/Hk4hABYzF01k2NLK9kK+FD5zbcQT1d OvT78SK24HqGEN6Dx+bSsAdBasYst+2jUQebHqslvuZ7SzHCjKtKGVJhbFQryXaWTa3b yw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2mxmfudpxm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:07:13 +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 w9D077V8018897 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:07:07 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9D077lW018012; Sat, 13 Oct 2018 00:07:07 GMT Received: from localhost (/10.159.251.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 13 Oct 2018 00:07:07 +0000 Subject: [PATCH 12/25] 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, ocfs2-devel@oss.oracle.com Date: Fri, 12 Oct 2018 17:07:05 -0700 Message-ID: <153938922552.8361.18136407106022565712.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=479 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 Pass the same remap flags to generic_remap_checks for consistency. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein --- 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 5d24e9854765..0c43997bd4a1 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1755,7 +1755,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, - is_dedupe); + remap_flags); if (ret) return ret; diff --git a/include/linux/fs.h b/include/linux/fs.h index b67f108932a5..b59637b2f484 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2990,7 +2990,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..c34a89a35d5a 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 & RFR_SAME_DATA) && (pos_in >= size_in || pos_in + count > size_in || pos_out >= size_out || pos_out + count > size_out)) return -EINVAL;