From patchwork Sun Oct 21 16:15: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: 10650935 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 B694213A9 for ; Sun, 21 Oct 2018 16:15:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4510287BE for ; Sun, 21 Oct 2018 16:15:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98211287C2; Sun, 21 Oct 2018 16:15: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 C5C5B287BE for ; Sun, 21 Oct 2018 16:15:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CE606B0006; Sun, 21 Oct 2018 12:15:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 87ECD6B0007; Sun, 21 Oct 2018 12:15: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 76E3B6B0008; Sun, 21 Oct 2018 12:15:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by kanga.kvack.org (Postfix) with ESMTP id 448CC6B0006 for ; Sun, 21 Oct 2018 12:15:16 -0400 (EDT) Received: by mail-yb1-f198.google.com with SMTP id r3-v6so7226034ybo.7 for ; Sun, 21 Oct 2018 09:15:16 -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=EsNGMCbvKoNvgUBRoLiO5NT8w4tCRyw3Aoe8lkfG3CHaQLEQZJ5Qjq/avYLYMGnbni yOo66IsQvIvG3FShl8fx56b19Ce9MXe7P+2BY9phXWHGWBSZ+tigr+B+yfipE7OheTrx b54qfUSHIaH98/J7XTQokAmFDlPUxDOB5M204k50olJnP0zSLMHKfwtzxzRuRNpGDlb2 IrcIbbozNz95PNpIn2TrP40IqUH6NPXMRsvs+0A6sjJe0GW+J3FfBRjrqmEJe7Q7F5fe P/5TcYyJoi0cv0i44iJkC3xNu8hxtpgjMIG80NYnecSroG07XDKZpYxPWROGEK4TG3rL XNDA== X-Gm-Message-State: ABuFfoizcsZc05lGjEd7R7TZc8PiDtsIKJYBZwopScQIENe/9/ONLPGM r8o44cKLb7pHUKK+1hfmW09A0Pfq4jtpWNeBfJrkbFAhdSEI3IQSQDy6s0yMKA7WCg6wdxExBwe +TX2Nz0pFI94AheqEQhCW7/DRwMc6vY1JwooHUl0xBeTNfciTPBDSRIlR0lq5Kh8/zA== X-Received: by 2002:a0d:fec6:: with SMTP id o189-v6mr30439169ywf.237.1540138515924; Sun, 21 Oct 2018 09:15:15 -0700 (PDT) X-Google-Smtp-Source: ACcGV60iKTlHxnQ1abMgojOmyEC1KbApTOIShg+NTXIyRfd77IcafUeh+jw3MJ1LHiquLvoqMjGY X-Received: by 2002:a0d:fec6:: with SMTP id o189-v6mr30439136ywf.237.1540138515437; Sun, 21 Oct 2018 09:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540138515; cv=none; d=google.com; s=arc-20160816; b=JJBVsLrJZXkwiVI91PfG5fqmgXJakbztL+lm05zRT+/4cSEOiM6Uoztn8fZOv+73Pd wUHBwiV3SO2tTensh11GRvgBSY8lkWtuXM5j27yIkZaZCyH4Q3hr7EChxMFWzRXhyadY W7FZ+pQV/qan9OPwMDjL8Rd4Bnto2sgG3sa/KDe+ZmrnjNXL6cCCy6w1GWN+Bwg/gM4F nx9/zKFo/LcJPQZxZfb64uEbW7X+haRqfLgDvJ4Wa9hwbxvXEAv83hpJNdvr87ecxeJR SRAg3F4eCh93xkVAXGLqalJzbep4b/s1e/72JGKDe+0t4lA0xoQ913dsExS2hhqBkggq TaHQ== 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=TXq6FSVuHGzaEQy31WNc5rqpsuutQc5aTtRSXrDfcP0dMx3gy+gFYbTd5LDcW7eLBr DhX8L1TXgk62ISAqrTBYQ/Dz1AnKisxigkMxjVLUJ10XUruw2Sa3/cJP02DfCZxAI/6a B0KX/MPGLzM22EP2D3CvraNqeoVhfvs+u+YBoGliqVtrjY201T/YZ8QTbjOukZpyNyy1 qZNbqt1ZcZZxNxaVA257RRfRnoDlprEa7AHA/ooEwNVW+CelckUJ71KENW2KztBLzL9u r+Dysg1YKQ4rc9ACzhXgmfWBDhhT9j+sRNONyMBvvHCMv/DMwZmPlssfKitr4y7jG0Ll reIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=zRXwM+gX; 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 w74-v6si802563ywg.432.2018.10.21.09.15.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Oct 2018 09:15: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=zRXwM+gX; 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 w9LGFE3x107476; Sun, 21 Oct 2018 16:15:14 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=zRXwM+gXg1ltSBXj2ba24XE/7MNBfcl2iy2/AnB1A7J7PTLR3wa/XCM/GpM9UlljtFQ5 Xu37m49IvoWmj8YoQDOJ/dpXgUTf0Hd8iDlFI1DgMxnfntSM4wW4nXIavqycEcBOF9A3 wah7i0+j32IB7ePjjtVy1RK7Pl3Z1yVspmh+d9NjLfRX3w4Fpk7NUhpg8jx6bJCV6EAg JDDsvpIDNFLQgOX17PF2pG67GmN+NWJ9/tbZ9GUQFSy5AIhsLjp/2xUY2iu+VtQxgluN fQi8FoNya//JohDJEFDzVaaR6RnBb/Q6/gODGCITszu+oBtu1XaNAV+bEuWdmsEZXX1I 3Q== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2n7w0qaxgp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 21 Oct 2018 16:15:14 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9LGFCU7010579 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 21 Oct 2018 16:15:13 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9LGFBCA020980; Sun, 21 Oct 2018 16:15:12 GMT Received: from localhost (/10.159.225.70) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 21 Oct 2018 09:15:11 -0700 Subject: [PATCH 01/28] 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: Sun, 21 Oct 2018 09:15:10 -0700 Message-ID: <154013851007.29026.6847850518000401463.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=772 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 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) {