From patchwork Thu Oct 11 04:12:30 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: 10635723 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 4564869B6 for ; Thu, 11 Oct 2018 04:12:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DCC82A612 for ; Thu, 11 Oct 2018 04:12:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 121372A651; Thu, 11 Oct 2018 04:12:45 +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=unavailable 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 B1D9E2A612 for ; Thu, 11 Oct 2018 04:12:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 978F56B026F; Thu, 11 Oct 2018 00:12:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9296A6B0270; Thu, 11 Oct 2018 00:12:40 -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 7CB076B0271; Thu, 11 Oct 2018 00:12:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 3E2D06B026F for ; Thu, 11 Oct 2018 00:12:40 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id r67-v6so6725572pfd.21 for ; Wed, 10 Oct 2018 21:12:40 -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=6YeYac0pIbKXg9gOOS19st5IEZX9NQyrMy4NIgyH78Q=; b=DYl8I8mKXHjjHBGeEp0csZcOzVjxDoapxQIAvsHsEdDzvXEcl9Uuq6rleBh8c9M9ZY iOrooMhh3RxV9npEXnYxBmzybejufOM3zv129ctXdLNErSjxyuHbtucV/cB3ZaamT0nS iwGWtRw3TgQaozp3lLJZPPuQQ/N8sUDQ078pZeOeMHqTNIV2v+xNmfNZYw/V1G5tQ1FD 3K3ujNu5YUtRUVIsxq1Bt05nG40o4tl2SEuhwqfPCkscpvnju2As1tt2WpcaYKrClrGf dhGeHrukwW/bqd259GmpHZ672MIdul/qf/RmgYxfM8Kt0drrjBEIV3ww1yI0TCTko3V+ xCWw== X-Gm-Message-State: ABuFfoivX/6S/mifN2QL3Wdp8p7sjN4j9ze21+UMonUoi1gZBVIw481i TJglPW8ot5Ipsgp7gAueBM8h02yIXAZg7AtyCdFYrBb0d2ltO24XrWsQlw0o+IkwMvcQtlXpnRi tR/1lMgwvrI3/gBhizf5W/96X282ZGJWUjxWaXzp6FCKUcBp3Vk8GyTKVno4UvDKfpQ== X-Received: by 2002:a17:902:7c11:: with SMTP id x17-v6mr1960635pll.1.1539231159937; Wed, 10 Oct 2018 21:12:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV633y30usTeGukYGHhCOO5UcJJANOnRRfHzBGVfH+fUilZjTGD9J354LHHWGqEMFK9QKtLMq X-Received: by 2002:a17:902:7c11:: with SMTP id x17-v6mr1960616pll.1.1539231159313; Wed, 10 Oct 2018 21:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539231159; cv=none; d=google.com; s=arc-20160816; b=bwQoLHwwT49Lm/CSAO2BHOmIw9NHKPVwXYhSI+9LOEBN1Pd3SMqGyABy2y01/YhIB0 llSrvjcUk78gv85TjxzfLzR9JYQ1k0L2Sjp1bilmQx9mLIjA8Ou8E0ir2RNVcPGma2Sz R2MB2otUdayX8SgJ+93yKlRdD17IpniiG1/JZXCayVJe7pR4UQMeOfvoEcEW92YG12AT lhsuLPXmKz67tMdW/rbtws2vw8LWHnZKTubrxRtonafBNgZibtMweQWpR4oYcZGqYMOA K2/V1yx+RB5cB/wYHvk79FYo9g0gaZm/dTVTIUpxqKQ33YnSCfyoB/gTNwBGiO4mI4jN PbNA== 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=6YeYac0pIbKXg9gOOS19st5IEZX9NQyrMy4NIgyH78Q=; b=M41PAiJfBst5XE1Jk/C/XtoONvCjm5vUEitNslT0xlWUYQ54v1aFdqPYL69hqwhQjA nsKC6RScchc4Aim7fZpKtC1FEMfkDj3Y7fDNKfXtQ3EAMQNqTsvB1NbpEFcgQIapxIxi Sr1mv28ajsdTdF9e/hwm0oP74Y/InP93StaV9D+MehXBb9BGeLdP7HAgHbXZsV8K+eJG K45bNWq9eI03AuZ9JbJuhg5x9/cqUlOYPBuPQ9PA0xz+bh+d8Ec7Ms3StJpgWKaf1wFG KaGiMuDuxXK+v6G7wlxkfI4HX2mJmBD1vAxEO10g9TnVMVce9CW+Oyj2vZz47gjSTNjF vThA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="vO/4IHrn"; 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 d38-v6si26938748pla.422.2018.10.10.21.12.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 21:12:39 -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="vO/4IHrn"; 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 w9B49FHM033615; Thu, 11 Oct 2018 04:12:38 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=6YeYac0pIbKXg9gOOS19st5IEZX9NQyrMy4NIgyH78Q=; b=vO/4IHrnOoofZJCBptwjZ9Qo55D++9a/1ctvSo2CafhS7XIjC899jD00pPhwkk7Cn73N MrsqqL1ga40tQ4061uTd7P2Kv85I5dg3xmV+PMlkM55i0t6xqFRj+ljBTfq2hv9PI/fk /uhDShjNh7dpoTvVLvKw+d2HrFm3AB/HCsmP47t07ObRH4w7H16u1B7cfPSkQBNPs5hy Wqnp16Qxz8eRJp8xC4m+m7sroiwl6CoMiJxVfP0zlY2v/aev7JZ7CzBNPjUhbNDfSo7R ZKq7aAeHkPuUxpdgicCto0AmcBqfL5PnoTlHAyPXLFm5bcYghxA+IBAfTcLhJ37GoPvk Eg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2mxmfu1fuy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:12:38 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9B4CZsB016580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:12:35 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9B4CYrn029468; Thu, 11 Oct 2018 04:12:34 GMT Received: from localhost (/10.159.132.249) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 11 Oct 2018 04:12:34 +0000 Subject: [PATCH 02/25] vfs: vfs_clone_file_prep_inodes should return EINVAL for a clone from beyond EOF 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: Wed, 10 Oct 2018 21:12:30 -0700 Message-ID: <153923115041.5546.14464512857556875980.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=739 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810110039 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 vfs_clone_file_prep_inodes cannot return 0 if it is asked to remap from a zero byte file because that's what btrfs does. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/read_write.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/read_write.c b/fs/read_write.c index 8a2737f0d61d..260797b01851 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1740,10 +1740,7 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in, if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode)) return -EINVAL; - /* Are we going all the way to the end? */ isize = i_size_read(inode_in); - if (isize == 0) - return 0; /* Zero length dedupe exits immediately; reflink goes to EOF. */ if (*len == 0) {