From patchwork Sat Oct 13 00:05:50 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: 10639417 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 6F6961508 for ; Sat, 13 Oct 2018 00:06:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D4CE2B78F for ; Sat, 13 Oct 2018 00:06:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51D462B7A0; Sat, 13 Oct 2018 00:06: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 E4A8F2B78F for ; Sat, 13 Oct 2018 00:06:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 063936B000D; Fri, 12 Oct 2018 20:06:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 03B4A6B000E; Fri, 12 Oct 2018 20:06: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 E928A6B0010; Fri, 12 Oct 2018 20:06:01 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by kanga.kvack.org (Postfix) with ESMTP id C04936B000D for ; Fri, 12 Oct 2018 20:06:01 -0400 (EDT) Received: by mail-qt1-f200.google.com with SMTP id n1-v6so13689975qtb.17 for ; Fri, 12 Oct 2018 17:06: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=L870gkqD6S3aDKdn3eAOJVgjX5eONlTDEgfFmDNElAY=; b=Z1wCY047urKCLgeXvxA7JODnUF+7bmZzeWAE2FzowsKBHf6m3aFgWJL2yry5xHCxk3 LkluW35vg0V7dXtzoIWC1wL3DFF8RoFyuXqI69bZq7MaqWgp2emWdvYWIYE7hZyvcIBS R84aqbS7rxGo+3ecaxZXepzGXwUW9z5c/nWAtrvVtSfvSgmQRleAAYTseZsTeceA44Qi fRguQ3WIp4fJ7/P+3SRjtqTjVYwj/mBiXTUvbfx19UR8MVhVvTRdnvT0HEZmyhzMRRPf BVapozohwERX/nF897LFgyy/Vq6GaPLQFjW86Go/N28JXcrDcSeRxEPINnWkfadavb6i 4juQ== X-Gm-Message-State: ABuFfoivVqj7r2sItOlA0hBrGgwHopcfdlT3hb3EAUZTuG4hpFj4onsM /gLimjoSnpe7ZAq1hpy1s2jOeUS/ZpxTRsu+osRH/D1Hyy4btWqQbBxKOeelkNuUh+DyAY/ZRzV imAJDOwRmOnlp46OyLEFx2VpljlcndGtjiBpWhJRTohiqgOI7kB4VGUmFwWQ66+iJrg== X-Received: by 2002:ac8:29d3:: with SMTP id 19-v6mr7598098qtt.174.1539389161575; Fri, 12 Oct 2018 17:06:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV6198puzFkkm4QzUT4pnm1tlknLJF5+3SiC/9D86pbsibcrMyah+SJROkQddX5qchXgPt0LJ X-Received: by 2002:ac8:29d3:: with SMTP id 19-v6mr7598085qtt.174.1539389161127; Fri, 12 Oct 2018 17:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539389161; cv=none; d=google.com; s=arc-20160816; b=Y7bDd/hJB0A0GegRvxmWe4MUjDPF4zsSz9yLss25MgLeH4d796cENN4QodJtEdv4G1 Bbop47wwJTqYic9kHB4ZLObA1mnHBWI4vwVogYJIkYZJ6PP0MMQAhT9eT5Rrvb2wnmWz plv89xlqddJ73D73TkHQgEDo0heeeQBTF/kVnTcNNMn8Yxal+2QpgkBNlCQcU1zh6WCB J3q9rhKHZA0z9RB5TVpEieHRpQTbsE+6zC/adLMGU52joVFlNf+RRI2C+4IP+bEzhGcb Hq2SJfrohro5aeHoXCy9a5CADcFeaKlD8k1iONiHVrh0WLBPUxLwtSoQDvzym9vyKXD/ m0pA== 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=L870gkqD6S3aDKdn3eAOJVgjX5eONlTDEgfFmDNElAY=; b=fZIgKOpT9Mp58pMwwTUxNeEVUuzt0U+pLxlFxz50xl1y70QJK4Dh+1Qh9/P+0sKBuY buLEDmGbneMqZndgyDDzNVUEJkG2y+gp6aw+47bZbJB4tEVShkBidIqGfV04Nik2SxU2 nAYLPmtxMBB8q1+0ZdTP7fRbnupaU2p6BhClDwJ/h1uYTqHmHCVMH46Qp1ZcRvEjyV6k 2q6x9BxQbZij5YMmGplIF4f8iCdiWlWU1sEToTyYvjSZ5GJfWAeUj/YXIysfCQs8HoxZ j9DWA5ChZ+B3DFKUYBXDZ8IdfEXP4EwIS4Somu7mVQo2VkxIVfacXIB5bAi7Y21G5+w1 1FZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="HK/nAUKz"; 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 p43si2467178qvj.72.2018.10.12.17.06.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 17:06:01 -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="HK/nAUKz"; 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 w9D03ufS143565; Sat, 13 Oct 2018 00:06:00 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=L870gkqD6S3aDKdn3eAOJVgjX5eONlTDEgfFmDNElAY=; b=HK/nAUKzSLROTDWa3mGInOfY/4F8xzPev5WsvyQknxjDrGdlyJoEPZLIgKRucM1a6ZYn tS2VbCwEehKsmB+/3n7HnrPbYnHbcPc/CzOwXoOOEh4DzX0fQ0XpGCp9cp6lp+j2Uomv LK1zkVHxDqoJkWU+Xa/l0eT6RXpmY059QNNhFwzruM+WnJLUueNC9GgjlkaYG2b9lkN2 weIROM3PpVvbZtRdviMRzfTiiz1g7GGOLz3vEOnPR7fhfiAAjqSIuSWLqmbY1CclBPNk h19lTurxwEs1rVZQDXShLIVtviw4P8toaoLiUgq+TS80vJyOzG5VrFaiiuu2jfbMpfSC CQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2mxmfudpud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:06:00 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9D05wH2001052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:05:58 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9D05wpc019165; Sat, 13 Oct 2018 00:05:58 GMT Received: from localhost (/10.159.251.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 13 Oct 2018 00:05:58 +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, Christoph Hellwig , ocfs2-devel@oss.oracle.com Date: Fri, 12 Oct 2018 17:05:50 -0700 Message-ID: <153938915033.8361.8568201027937509597.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=770 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 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) {