From patchwork Thu Oct 11 04:13:49 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: 10635859 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 99CD4933 for ; Thu, 11 Oct 2018 04:14:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F5DB2856E for ; Thu, 11 Oct 2018 04:14:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73C542A63B; Thu, 11 Oct 2018 04:14:03 +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 F31022856E for ; Thu, 11 Oct 2018 04:14:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0ABA6B027F; Thu, 11 Oct 2018 00:14:01 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DBA806B0280; Thu, 11 Oct 2018 00:14:01 -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 CD0326B0281; Thu, 11 Oct 2018 00:14:01 -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 8F1BF6B027F for ; Thu, 11 Oct 2018 00:14:01 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id i76-v6so6746683pfk.14 for ; Wed, 10 Oct 2018 21:14:01 -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=H7fqbZNarcHp8AoXaNeFCNJudr51tNtSEzebsw1VAEs=; b=YKoq2wQ+AYWgux1/Iw30RNMeUlt99ORBW3UA3lK6dXwe98b3G/IYoebzGHZtxkyUWQ KNf4oWG/qIyLZ4DOfBbKDZhnlUSsRQyP9l86W/sPSQKIAvOHa/gtRVTBBDknjI+H2Ott nXnNugcP7iUB4Y1cVjcFIjKMzhkfc6fWnQccn6shtncbAJTmMSKeYPLyAHKOJVPI9mq+ Efb29JTErr2z3Rf+Y9akzl9C4g4dzCh5FiibNn0LnM1KokUEd0PsjUdLmlRrgnHAKvWp KmFHZx4TqBFmTr4IHVNqtqqPc1iYrXk2lPoVumTHICWqtDr3tsdETBnMRwNZrRbyaQ3l Anng== X-Gm-Message-State: ABuFfojyx3wACkUk93KvmFAbh4kcmZNiSJ0g180FQh53socLJqAqctEu UPMRLPt6NXokEnYSkH8uiIrlUgV/krTuDdobBbOeI1v2XKKzKWLoj/LOS65HenxTjVqIvN0xpnx J1TquJHc5nEiFfoMpPIPwd8dsl0gJVeICTOC/tQMmNfCnHZV+KNSCtSCBDfkMX0ZD1A== X-Received: by 2002:a17:902:48:: with SMTP id 66-v6mr24930442pla.7.1539231241272; Wed, 10 Oct 2018 21:14:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV63wXmRvA5Y5XpDkzsEi2BHCnaDclJFMD4fkLU2fQRX7GSvVgdgzlyq8L4yPPr+Qt2GnlbtZ X-Received: by 2002:a17:902:48:: with SMTP id 66-v6mr24930405pla.7.1539231240605; Wed, 10 Oct 2018 21:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539231240; cv=none; d=google.com; s=arc-20160816; b=NemVJDTV72ubhS1L4RpauR+/7WTQMqSGbPrflaJRbELva7MbAyjxVPPBDHMRCuCzCx 5GctvuF4nQuhIGenb1X4a5Nb+RgY0Xvo+jmPzOHNKg8hV6uHqpu0D4t6cwIAgPIuxOis 2AmYKUxbgiEcSJv3fvsRuapiIBHF+hvvmOIEslx/MkD+uSSx6xR/lpKHELrZwHIkjqsf hIfuhyrBQAmkDndOqt7k3KDgirndtYDaPIjIdEIHGO/Crec1/KJbIgbJ9NQoetaY9P7B I7C3NJu3VTJ1TwiaM69jk9Ml0WQAjT3pKAZo0oTsZib1OElxJnUNHVP4rY8IU7i1s/Sf ys+g== 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=H7fqbZNarcHp8AoXaNeFCNJudr51tNtSEzebsw1VAEs=; b=gDCjkJwjQ51P2ggToR1taUILAaHx77Z3/xaITtYivIHYNSiH4wARNYBl66evYa4o38 yuno8N7IgktizSs5YKzwWMQCcAjCzDI94B0pLjJfeF/M+/3Y1mJgLOl3dN/s+R/yOfIx oaUnVKbOMIH3p+JVqHXtE79pMaCex4o7cMmyCOyE4vDoia0lWdB4udaX+KZ2lb8c5TAo kKy/5pz+n1hzYBG7zI0AlbeBcXjYGBPx2rR3NktDhfHJnaQ/+oqN8hPrB8ucc8fa0rym j1F9ZvBviaty5t6CdCJcFlGZx63YoDd6V0lQD6ByIWUt3za1HY2L3S9vl85o7Y4LnaV3 katw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=NjMca7MO; 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 d35-v6si28036824pla.116.2018.10.10.21.14.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 21:14:00 -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=NjMca7MO; 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 w9B4DwOn039315; Thu, 11 Oct 2018 04:13:58 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=H7fqbZNarcHp8AoXaNeFCNJudr51tNtSEzebsw1VAEs=; b=NjMca7MOVtqMyMDzvskzRDBYLmny1Gt9FmHLWKTZF+Yj+QDldXDEGAaGWcFg1CawLNBO 7G8Bt+QkJ9MvCJJZlNax8o9Zj7ehagZNOXtfUIh9cAmzVCuoRCva2lxYsoI3BH7RlYdt 7JSEeIlM0cE+4JnI70cwV+uYMD4NgrsSzj/PrZf/Riz82KNFt1EI9KZKSSfmSdC/OYfg W2KF8O2aDW9m9KKmRRU9T4+siGJmvlz4U7xXd/1b4CgwuU6hYCTPLTUufLyd/Rs8QILC ecMR1xQTZiAQzWVE/p2ZQ1US3AI5yZwFQTFnn7BhzkdZTVzM+0aCOFYNejwPIu0/DlOL xw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2mxmfu1g19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:13:58 +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 w9B4Dqtu016810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:13:52 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9B4Dqew012000; Thu, 11 Oct 2018 04:13:52 GMT Received: from localhost (/10.159.132.249) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 11 Oct 2018 04:13:52 +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: Wed, 10 Oct 2018 21:13:49 -0700 Message-ID: <153923122899.5546.15614724337094695251.stgit@magnolia> In-Reply-To: <153923113649.5546.9840926895953408273.stgit@magnolia> References: <153923113649.5546.9840926895953408273.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9042 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-1810110040 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 bd5f8d724b13..5de5d102ef4d 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;