From patchwork Wed Oct 17 22:44:36 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: 10646175 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 25A3B15E2 for ; Wed, 17 Oct 2018 22:44:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14583288C7 for ; Wed, 17 Oct 2018 22:44:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08361288FD; Wed, 17 Oct 2018 22:44:43 +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 9A71E288C7 for ; Wed, 17 Oct 2018 22:44:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5CE56B026F; Wed, 17 Oct 2018 18:44:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9E5076B0270; Wed, 17 Oct 2018 18:44:41 -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 85B2B6B0271; Wed, 17 Oct 2018 18:44:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 447766B026F for ; Wed, 17 Oct 2018 18:44:41 -0400 (EDT) Received: by mail-pf1-f200.google.com with SMTP id h76-v6so28297987pfd.10 for ; Wed, 17 Oct 2018 15:44:41 -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=6r7g0KcDO4x0ZJm4RBSdxfhsKMbYQWElnIgn2PkV3NQ=; b=kJWd6ibpwE2VAMC+AEQEionVyRIwWirhTN/0zK09Bkq168Z/vSY7CytBTMmYG/mWwf +FjNGPDbOwIlOsG3GA4CbnFRldbZ/tqLmrAx81m/MEphvd4M3u29eswJud6jXqDZ8GHq tf6O50lx6d0xahFKykrZQJ1CfVFMUmGw+Z2DoWJ3LfTTONUKWrLBgg5ojecoZ0jlLDJW nd27aqAl7ikXNjpm8P0EIo2vUyGMXnJs+h+FPlEZPX65Pf137OcM+b9bavI1q4nBJ8mL bx5VWWz6+hovBxNIcCjcicIxIzjny+9PvfaeNYhiXU0/crDfNH1/W1JtbMt0Nvdp0mg+ rweg== X-Gm-Message-State: ABuFfoiSCmMjnoqM2CSalmVvHy+JI5i7BzCNzyPeL/KWoNw+2jNNbffc o9X2o6RhPxQZg/iYQvsRgS5GuZIKkMO09xQYE6vVljetmkpkWZcwMxr51u4RchYTHcfnxhRiXXZ K0DjpeJcWxPDoGNIEEEcWXVORiX58PRRlFpv6MQZGT3J0fHnp5WLfKPuHup2ePOYY2w== X-Received: by 2002:aa7:83cb:: with SMTP id j11-v6mr28187125pfn.91.1539816280961; Wed, 17 Oct 2018 15:44:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV610Obz/yc+cCIHIyJSabtWF6yMSdMzLsmrp254hqUmrLe9YPMcoldYWDWg38+eA7bGi9ecI X-Received: by 2002:aa7:83cb:: with SMTP id j11-v6mr28187095pfn.91.1539816280277; Wed, 17 Oct 2018 15:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539816280; cv=none; d=google.com; s=arc-20160816; b=fIT2n2KoZIPG2mgE8l5yX6xox7yLTyojmPfFyNkMpMg+oSVNCGfxQVdWcUN2aumhce KHxlzpACVQHL6zQ/iBCIeVLGHMLZ5/SXGT9wzhA3f33BgrOzDbNhffeBzRmHY5F6HGCV 3QWkpkarOvE3Z8aX0cKDiYW0EWh4t51MFUJhbr/Zm8dEl5u3iRgViWjrRwiuUBbUgfhf fxazkdJXu30V1AbvhRqMSIsWNuEgBl6UQCsjMB/tfkUmE8YPVEfmRi6FVUvhHcxliQcF vJ9yYJsmIMf/RKV2dY7aMZ5cEfO0JPRVkm54uMasXq8Nz+aFC4k3ymC8m3Tyq7Pz1Ewh 7wZg== 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=6r7g0KcDO4x0ZJm4RBSdxfhsKMbYQWElnIgn2PkV3NQ=; b=OFTgrqVxfJLhMcNR/mFvJTpYrl3YhEg0Xk0JQNEEuaLPlx1dpsx6xMkBMHsCLW5aTI d6DThaabrYCuBeKQ0dVxaePBGMjrmf3Oqx1BWHTdBtx++FLwwIoeXJeiz9vSRQLwasSb hMhFvhVilGgharsggVD/RrLdDBh0+1a9kzbGowKnbZ16HZ9eRwXfNh9pZaThjnHyNOZR KZ9OkiTQM3fyGbdtbsFjFgeLDv2ooIUON7k0hj+33+Dxj1UwfmgdzkczbceMYUvs7p+o QVk0wSoKbqcDNb9UzT/WQ4CLLtSkDyPLd4r+oUjXdt7TsBH+W+4irZPD6erX4sEg7vaQ yqfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=FNGNbPNz; 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 c1-v6si19125447pld.107.2018.10.17.15.44.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 15:44:40 -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=FNGNbPNz; 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 w9HMi1fu189345; Wed, 17 Oct 2018 22:44:39 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=6r7g0KcDO4x0ZJm4RBSdxfhsKMbYQWElnIgn2PkV3NQ=; b=FNGNbPNzL+PSO3MkE92LNJ6BtsRlRfm0F4OuajFlHs2UrqEJwp2HmmIoaIZWJJfsNp1I LzerlI9NsrQ2ZLEtWN2TDu5V3H1XIQkRj9vgTUQ/fQ+m/6MkyJyiS56ugsuWffnE3jvk NKzTHh05uhSDAwwLjvbLhSiBN6Ac4EfIEEvRGqEi4iQ6Q9Hw23krKFnpeCu6hGTAnFTt uq1G4AzgJj5E/TdA8YVxXCL3jPBZvl9DixrhHbd6TlS41penHakBxmDS8wMA4026fItr znrg4P5iRxvW/6zleC9GA+AkNmcNg1pr7/FBzVI0zhtzqLvO96PB8r6PuFD+Ew6Z6PXb Tg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2n39brhnyy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:44:39 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9HMiccJ008088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:44:38 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9HMib1w031348; Wed, 17 Oct 2018 22:44:37 GMT Received: from localhost (/10.159.132.177) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 17 Oct 2018 15:44:37 -0700 Subject: [PATCH 03/29] vfs: exit early from zero length remap operations 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:36 -0700 Message-ID: <153981627600.5568.16857314567554014035.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=710 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 If a remap caller asks us to remap to the source file's EOF and the source file length leaves us with a zero byte request, exit early. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/read_write.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/read_write.c b/fs/read_write.c index d6e8e242a15f..2456da3f8a41 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1748,6 +1748,8 @@ int vfs_clone_file_prep(struct file *file_in, loff_t pos_in, if (pos_in > isize) return -EINVAL; *len = isize - pos_in; + if (*len == 0) + return 0; } /* Check that we don't violate system file offset limits. */