From patchwork Wed Oct 17 22:44:22 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: 10646159 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 10CF71508 for ; Wed, 17 Oct 2018 22:44:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01945288CA for ; Wed, 17 Oct 2018 22:44:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6A41288C7; Wed, 17 Oct 2018 22:44:34 +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 C38E2288C7 for ; Wed, 17 Oct 2018 22:44:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC63C6B026B; Wed, 17 Oct 2018 18:44:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E75946B026C; Wed, 17 Oct 2018 18:44:32 -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 D18896B026D; Wed, 17 Oct 2018 18:44:32 -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 8EDD56B026B for ; Wed, 17 Oct 2018 18:44:32 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id l1-v6so28101709pfb.7 for ; Wed, 17 Oct 2018 15:44:32 -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=fySikyIyhHbJuiv59mUgzxXs3yHiJDqwW0Ex2fXz5W1KNqEvWzSPFQ+i9hT3JCKk4R W+nz9ME2CiXVr4YkGloRGWBy72YIBcRLXiZ44iceHQPkUh4KYP1Zd99sMeItOcioyOIn KyyZyJ4mzO6p5BXKLGkwCof3xsQPprV0p6l/T5CZaKcAiu+SnOBbgX3LEYmS9s6zXjbA Fy9Y4CdfWQZeQC4Vkok7XzKG90Ix/Sj+UIXdI8EmPDjvNergZgjKw5tF2rPmqD0Qkr3t A8a6HVdncuULOS1LamCfH58cS7wyAMnkxoJkmawpl2voRHT/xqx9wcj3n35VYxWzf8k0 3fTw== X-Gm-Message-State: ABuFfogOhBdiGsQpLdWWlr3kLJHFIc7rf1h/D7dcI9oP2Jf+pp9Y3LSb W6GoTg2WZ5R4PzHeOc1YZ0B3vYToU7hH/6zdl1F8Rvcb5vMC1cTF4WDq3DSNYzpdqWAr+LjxyTY 1BfDmuWRPKaJqJPCqEiCf3NtoV6HfVLPGpcxl0MGmQux3ra0L2UJyWgbdLEAkjsBpbA== X-Received: by 2002:a17:902:7785:: with SMTP id o5-v6mr26897032pll.200.1539816272146; Wed, 17 Oct 2018 15:44:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Zx/0tkPxbhJ0x4sJ5DcAwEPveg4bX5lqB+ztHOEKLTL2MTywfjtEBONQZSLjhcZpYRh6y X-Received: by 2002:a17:902:7785:: with SMTP id o5-v6mr26897012pll.200.1539816271528; Wed, 17 Oct 2018 15:44:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539816271; cv=none; d=google.com; s=arc-20160816; b=cMdGFMlqaWYaOrSuqpYF191nf06nLCfHictUrZnsbVQLpFqaqGzDNKsIsONuekmejL kava5goEPJeT2SNyjmX0xvWJpM7HN8f+m8bZs6mEZX98NpoTzigcw+BePyNaBdL97N8Q khvhI9ki51IwlnS3cAe4tlyN/WbGQTcTG5d2OENSzM1XJa6O1PaKEDaaxuqzSxFSR8kx S7ugsl9GPjbe0h3yoGOtKyPVqW/3p8bM6I3P1EBSO0M0gPT95moKxp/iUjLWcM3tN3Bo M55/EPU1DVepmKDPXOcNZvtX0/tc24e+MXsfY0A1qnAnlP85nzXcyUD1575FH+z1F9qf Jhpg== 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=KVg2E8MyusLR16nOnoPEWT6mJBhKNcUX9TTtiEpos1hrtUASxfJjuGvz9Px/8eJ4hT y/ymoKyQ9gAYVK18DoEiOvBlvf2loBb5e3E1YrQGcLvCwKoM1MjE6zlFHpFz26csD8dT u7Jjnn28lf0qoxyl5uFLDE3Qs30jOjYcbB0SeyAjiCOQ0UUf6urvUYQXMe/RvD0Vc0ch nI8NWm6sNjgj1Lk8q+1QwYzxUY0ytqR8SkacuT5QdBAITXgCYSpiKHASHQkN+0r+hF0s tg1m2uxleOcb6FPhUtJ7GcqocNPqQt/1RiyREoUNcE0fvrGPkEfR2gWhbQ3NI8/K3jSv pFzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=RArLYJOY; 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 q13-v6si18334990pgq.526.2018.10.17.15.44.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 15:44:31 -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=RArLYJOY; 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 w9HMiG8f189458; Wed, 17 Oct 2018 22:44:30 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=RArLYJOYiIMZxhxHnyzcY3Md1C87caBShM3lmFw4onOS4VzfdDv4ZGywN+P9wPFRduIX ue9wgrfPhwWcr6wubJZQB+zkEyQHIrj05yfDDXfgbMfFQnPIpJ8NZNDdpSdmssaV40H8 TZ28H0IyMvYayGDZtMx6gSz84JPOjXhuVhUXAnv75CTgcRxTyFaAekoVLWXRUgiyQWzy uGliU/tn+JlNwQqq7OJM/TUV7qqA0Y6v6M2eOiN1XTOL7IIL2d7q0upsaaD8rFveFmbh y6HKp4gLg4hV1vd1QHEIco4ex/HWWU8D16NgoD4Ct0aQz8FGn3P0C44bLGlgbMMdRLLf gA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2n39brhnyj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:44:30 +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 w9HMiORQ031959 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:44:24 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9HMiOIN014426; Wed, 17 Oct 2018 22:44:24 GMT Received: from localhost (/10.159.132.177) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 17 Oct 2018 15:44:23 -0700 Subject: [PATCH 01/29] 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: Wed, 17 Oct 2018 15:44:22 -0700 Message-ID: <153981626223.5568.3466392756612301245.stgit@magnolia> In-Reply-To: <153981625504.5568.2708520119290577378.stgit@magnolia> References: <153981625504.5568.2708520119290577378.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9049 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=775 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810170188 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) {