From patchwork Tue Oct 16 03:10:10 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: 10642697 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 B3D053B73 for ; Tue, 16 Oct 2018 03:10:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0EC829866 for ; Tue, 16 Oct 2018 03:10:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 948DC29883; Tue, 16 Oct 2018 03:10: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 303DB29866 for ; Tue, 16 Oct 2018 03:10:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DC606B0008; Mon, 15 Oct 2018 23:10:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1122E6B000A; Mon, 15 Oct 2018 23:10: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 F41936B000C; Mon, 15 Oct 2018 23:10:15 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by kanga.kvack.org (Postfix) with ESMTP id CC8C76B0008 for ; Mon, 15 Oct 2018 23:10:15 -0400 (EDT) Received: by mail-qt1-f198.google.com with SMTP id k14-v6so9293971qta.23 for ; Mon, 15 Oct 2018 20:10:15 -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=hrmjQrusksZMSf1u8b8Pksp659W/ykhNJ45jcVfPydHtC9u0BSD5cggBoPj5RwlXaI XihfkmZoeJbkUIskxfLst6MH+Df36DECIqz+USbEHbJgsEGOVLQUx2IyD+GdFY/a6Omh UPDV1st4HyGRuPsAhO7yt4Qv6UKfKlgqoyeja5SiQ4W3DX0WrHGWQvmyWbKA12iR0t4F EeCelNRU9JTpsZ+VNEfE5fRnDBM48asUbT++d/vPbTaHGLD2gS2alh/ULo3W0yB1i/L3 SZ4vYDxTDjQ1R8kMex4i1x0WAPxgg6iWgCgLjo2h3lLglQ4nAXcHP/ZV71IB2+bKTBtD L/cA== X-Gm-Message-State: ABuFfoglBjRXUbQehjjwt1UhJYh4R4KBN9pXmBagnOHA/BeJ9HnliKww Qfd0j43PQRvTaGrn7SIvb9KMNq7FD9GGyfiIkVTWAPl91S6Segzu8/joRpdJva4AQSu1Pp13qJU l9BFmtiOpsyU8yzKZkM6DzCfXU7UrxLOOtoXlJO3EKVnny9IOLYyDddd/KLeGWVnFgA== X-Received: by 2002:ac8:1307:: with SMTP id e7-v6mr19279896qtj.22.1539659415561; Mon, 15 Oct 2018 20:10:15 -0700 (PDT) X-Google-Smtp-Source: ACcGV61zU0lpbfq8rGwWDcrIMGhLcC9zNnUH/NuAtyuw6xw8tADi4BNoBVbIAvrEb6vNHwpfifCW X-Received: by 2002:ac8:1307:: with SMTP id e7-v6mr19279879qtj.22.1539659415105; Mon, 15 Oct 2018 20:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539659415; cv=none; d=google.com; s=arc-20160816; b=ZOOADnSMSXWODOGJh14ozqq46eyWA0yYt+FM48cFxL6gvrHfC4alc8MRkZIJ30ysye Qw+uVeZRKeSiWB0HUWzhgiTkOYmw0T4SMY5GI6AEkgRhpo1DsJIYrHCOlmtXB7OPBDz8 GY730aSsgo/otlzcOcG+7lGavH8lNJk9RP9zUbxX8EFaSFENfrRRdLEMLWsVT87JH8IA 337OswttAbt/tJjdQHj54r/Rw4igDfmzjaResQHFr3IiVXm5YhjovvUFBmPMbpU42sqN 30Ib9UZ222Zka10LwUmxcTkVqCZFTgk5FG/XWGwjdOhL/EXBFTLJKjPIVGsS6RejO+/M nunQ== 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=QdDOyOj7Nf00Pu+fDUM40pUw7u6yZMTTgVnx1IxtEQmy+13iTRlg/qnezeMi5xJNyS IG+bd4OCB8qVRrE3v3POlwV+Vm0CCBci1hzI8FS3AVpoQ7XMSvHOj/7gM2pV1JxO88cz mUln3VhlebjV/PJ1hUPuHUl1TGPd1oUG5S9sz5Ck5QhO7yCL8fuqlOvuxZxeQ+pA7uKY 1u7JkdBzfpGi1ZAy1JNpzWyVNENP3rvAXI/B2ox17B4pqer4jxwml9ajJUx+8vppCE6F 4OrJI2ZIhLEZsXcfo616y9bt6wrlomJ6Vxcym0p+2+MJskkO3P7aVQeaLWZWMxYXQGXY IWfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=XllOKrY8; 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 a9-v6si7327607qkj.205.2018.10.15.20.10.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Oct 2018 20:10:15 -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=XllOKrY8; 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 w9G38kvf194463; Tue, 16 Oct 2018 03:10: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=L870gkqD6S3aDKdn3eAOJVgjX5eONlTDEgfFmDNElAY=; b=XllOKrY8cAytaoxC4m7J4MhD/VdVQ9hegLBpkA75zanOZcciXNTm8leAc61pDxkQcvNC CSAMKK3iD47qi8iNCHt01kco1AmXgi3jSeD3SkHlkceVTbLQ7xzQw3M12bozwRKjPHq8 qGnVv86cP2PpchaHnoYiJrjEoVNiTPGQbx82O/v5ZewIrC0i1vh6KzYTJrKjdkJ4r5Lo qEMGJmXlkXgdKcxgeH+cz2zPgHUGjcKRx3MLf6sDWA5AUdGo25ok21K4BbuhaImh/MSY y1wTMUKqfK7W4VENPsOE+2S5SaQqfKi47B1qvtQGgWr6i2//ClmtA1/u0yUfOPryQ9pi Rg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2n39br5raa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Oct 2018 03:10:13 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9G3ACcC009182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Oct 2018 03:10:12 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9G3ABpj004884; Tue, 16 Oct 2018 03:10:11 GMT Received: from localhost (/10.159.227.150) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 15 Oct 2018 20:10:11 -0700 Subject: [PATCH 02/26] 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: Mon, 15 Oct 2018 20:10:10 -0700 Message-ID: <153965941007.1256.17570514092450613034.stgit@magnolia> In-Reply-To: <153965939489.1256.7400115244528045860.stgit@magnolia> References: <153965939489.1256.7400115244528045860.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9047 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=771 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810160026 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) {