From patchwork Sun Oct 21 16:16:20 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: 10651047 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 C84F213A9 for ; Sun, 21 Oct 2018 16:16:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7261287BE for ; Sun, 21 Oct 2018 16:16:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB672287C6; Sun, 21 Oct 2018 16:16:29 +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 30442287BE for ; Sun, 21 Oct 2018 16:16:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 578846B026D; Sun, 21 Oct 2018 12:16:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4FE1A6B026E; Sun, 21 Oct 2018 12:16:26 -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 3C8166B026F; Sun, 21 Oct 2018 12:16:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yw1-f72.google.com (mail-yw1-f72.google.com [209.85.161.72]) by kanga.kvack.org (Postfix) with ESMTP id 018246B026E for ; Sun, 21 Oct 2018 12:16:26 -0400 (EDT) Received: by mail-yw1-f72.google.com with SMTP id b76-v6so25265646ywb.11 for ; Sun, 21 Oct 2018 09:16:25 -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=Ax8fPC441txtB/zxSXAjFoiXirNOr5aJSks+n5W5dVk=; b=QmwSUlJ0EguQC37tNS5DvIS8KgpBAXTHITH+0fbV/adIjIHXHeo6PSkbE4s3oQScHR WL/ZCFGhcrJNhVbAUrSfTqp9N7JZ5M/sBz4nxW1siFjs/B2Z6wtnEuQu168KEdD8A1tw w/hh5vsz164vujiHvaVuc20vkBAoYMM5CC521ucnEULGS45+AD2NTgRZKYKMkT+Ttk5d iOUaoXcbK5umxojXdAdbQhVzoTnzCsPPjJ9saHQ28wcU+QQgZeJtgMaxwxhFSdWyHzAb bsnjF+D+dOtPtWp7Dah1XWmSLszfatMZlCDYCK0tzYB47YWF8Tku9q4k5CHi4CM+EHyO so8g== X-Gm-Message-State: ABuFfojRrPL3uzKWPCSsIQ5rlucq6+hfrrnOXVKkDpk6y1vksQaD1dXz tDTdtsFbh8ds8JOjjgCY4B0bQEomCLafwNUB64/uRiJBPy1/A7s0IvL31fdT0XvH6YYTfHiT/wF 5oQNATHlbKJucwTaL+w4IxIDJuaWwahXJXKSQl6ueMU6IO6EOdOzPbjCHEuz2P0nnnA== X-Received: by 2002:a0d:f546:: with SMTP id e67-v6mr29112332ywf.304.1540138585746; Sun, 21 Oct 2018 09:16:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV60WeufayksAgzWw/95kWpksbYXmYjBBPCEARaF77RjADZKSk/D/G8EkId6rMZYs4n768IXd X-Received: by 2002:a0d:f546:: with SMTP id e67-v6mr29112286ywf.304.1540138584935; Sun, 21 Oct 2018 09:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540138584; cv=none; d=google.com; s=arc-20160816; b=axI7DVGpB7u0kFLR2Q6oWWplIG5rWM+aUYepnfEplhctQ8h7CRjbYnWlFBrgRBlo5Z PH8QNRyMZOOV72+aYDofXDRarpm9q/YAVtf5dOga9pmrbyhi5nfErWq1DEeHbluHPAh7 ChuiAhgb8SRMioUOS9lI3lx9cfikOVZrKRzV2AEbXeCLJ7fwCJ2gCWfhMab2IlHjo/fV Yya5JaN+sQYZGv95i5KCwjvngJUVVb6k0ltJtDeN+Ti5XkFeNV78AukxXp52xuH7p0uP ayouZw0oi9KJZmP68evcqHtg4iDwhkjvtJGsa07793GmJNIFl6CVGJOCgwkyFLqPbpL6 WWLA== 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=Ax8fPC441txtB/zxSXAjFoiXirNOr5aJSks+n5W5dVk=; b=jPuVQ2a7TH5sf8NOIR6qW83nEk+BZ2Eyp5AsxKgZUhef449yJQHxu+u678r44bE2sr G4+vrzVofiuU6QHCjWZ53gAox7uBU7TsvG9m6OVSAXmsMZNyeSgV3sFUCQ02f5HhryTi 0rK4mwecaZ6mj71Z0fY8Q2Qh/Nq9PPRORzyxvxVyjevif3107Sd82sAMUTslp8nkkXJn oiAWQgZRwt364K1APbyYbv0DVHtt9THG03AxWBXUzrnB3nRsLJpghNaOiAGa+mvs1iMu qr9AT9RBCqRHTamcihTFTDfLJdKPr6ZkA+77MElVZES1UQpCCkrPXe3eSs3u4jnhWMF6 0c1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=DcOx2GaI; 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 132-v6si13927131yww.36.2018.10.21.09.16.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Oct 2018 09:16:24 -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=DcOx2GaI; 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 w9LGEObc106939; Sun, 21 Oct 2018 16:16:23 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=Ax8fPC441txtB/zxSXAjFoiXirNOr5aJSks+n5W5dVk=; b=DcOx2GaIHgIOYJ7VwcXw4w7scujVFYT6o5xi8DKxadeahhNbgLe+mCcQMd1+49vrgsGv cYDylEHPay8idamCKSkuqRZ2RjC9JsQeOSWssUj9E38KQm0f5Y+nfBjgAdNNxVPD3ZRC 3JpjUK422zcaF7UCNCYF3itqMLWj+Z8gttuspY71p4tbGMEL8AusOT7Upebyj/H0EiqP i1793+TbFsKDrNQN39oqyqmiDq5ts0naMf2JQI0b2rQhnsuQNOkb5xh2BA5jzGbc5M6P pTebBU+qkjiHGRt28szyEfXUKwHq4VJ15Gy2SVLFOBAwnzFDktmPBudqTe4rBmd+DHnp pw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2n7w0qaxjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 21 Oct 2018 16:16:23 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9LGGMWO009030 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 21 Oct 2018 16:16:22 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9LGGLH5018384; Sun, 21 Oct 2018 16:16:21 GMT Received: from localhost (/10.159.225.70) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 21 Oct 2018 09:16:21 -0700 Subject: [PATCH 11/28] 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: Sun, 21 Oct 2018 09:16:20 -0700 Message-ID: <154013858003.29026.16188863826706349189.stgit@magnolia> In-Reply-To: <154013850285.29026.16168387526580596209.stgit@magnolia> References: <154013850285.29026.16168387526580596209.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9053 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=506 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810210151 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 631c28ce1436..c5435ca81132 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2986,7 +2986,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 84b7301e41a0..410dc58f7b16 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2994,7 +2994,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; @@ -3016,7 +3016,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;