From patchwork Tue Oct 16 03:10:23 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: 10642723 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 491AF3C13 for ; Tue, 16 Oct 2018 03:10:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 318DF29897 for ; Tue, 16 Oct 2018 03:10:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25EF92988C; Tue, 16 Oct 2018 03:10:30 +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 BE8EB29867 for ; Tue, 16 Oct 2018 03:10:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 99EFB6B000E; Mon, 15 Oct 2018 23:10:28 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 94D956B0010; Mon, 15 Oct 2018 23:10:28 -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 7CA466B0266; Mon, 15 Oct 2018 23:10:28 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 375E76B000E for ; Mon, 15 Oct 2018 23:10:28 -0400 (EDT) Received: by mail-pg1-f198.google.com with SMTP id s141-v6so15982400pgs.23 for ; Mon, 15 Oct 2018 20:10:28 -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=9TmCiNqyohhxt1dJj5u/Q03E/B3TZZ5o2UAiPujWx+4=; b=PuN9E2XzON6Hk7Ac2gtKlKdW93AI1vwYOpxAnj3451p43E+GBfqsaF1CZF5UXuXRan LdIFvUzMv6KrywjiuZdNL/qdsMrumHT33YBgxXN6X5d5i6/BDtD9F60RWiq1ARlyhruB /4UW+qSPskpkftJ0VaHlxkzywIaSbJzI8/ICQgFEFAPv2HeyLkYdCypyL4FMqdY5JN1G atAz0k+knsryillelui/1qm1IlL/TP9H4pdPrpEXIeYRXgbd9XWPZN8F2LiqpMzdLSp4 hvkInrOY9HHRM1hv/j0Wi7ha6OxhcDNpBs5GYesb4hH6g5rjIwifAaiwOrmC2tDQU40H wDkw== X-Gm-Message-State: ABuFfohCxjEk7fd0+dVLN+twf8Jnm2v8K13us2ijm3Uh1kn2Cg5eu0yk tcQT/IUaGd+izPHtqYTDoI25auLjPTXak1A64lsTUGhugprsUPJHqDhs48LnAl9k4LXhByzEZ/W eD6KIAKozBBmiNBSXn85YpY4kDW076fGnsemXBvUM8aH2/zGNBYlbKTkGBRMGUpARnQ== X-Received: by 2002:a62:f20f:: with SMTP id m15-v6mr19989606pfh.244.1539659427915; Mon, 15 Oct 2018 20:10:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV62sIpsqf1GwgRh36ch5QF/4d8Ds+3caK1r9XUVs6RuuvzwIKCpFSRQI9289Eq/+ZqjMooOK X-Received: by 2002:a62:f20f:: with SMTP id m15-v6mr19989579pfh.244.1539659427241; Mon, 15 Oct 2018 20:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539659427; cv=none; d=google.com; s=arc-20160816; b=EzWftZQaNwnBFKZRYm/AXiH9VRrrIy32/XEuMtMMmDwN0UNiunVK0iiB3yhAu0vJ0A W5XstPPnVP3ABDfxYVqDXfRRFmUS1qc765ofJUzvWs306HJAXdZMUjKNeY/oKOBP5mUP Bkv8erketax+9viau4GWuEgv8uY1lr6Totp2QH6ahHvn/TM12V5w7sHVz1+nLpk0c8Bb MsV0/hL1IrTbrBJkVsMOqkCM8QjtBU8TYsM/GI1YoQ/pte+0wTINUKv+YUxKaGpXdNql nh4YCUecwjA811VpXL2oDaOirNFumEjKm1QR6n5mPXgzJjuzhj7iDglRDbvUaA9TjDGa dmbA== 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=9TmCiNqyohhxt1dJj5u/Q03E/B3TZZ5o2UAiPujWx+4=; b=U3d5TRaAcCQsaBekMzyJz402ZweLXVDEPzGksXmXZLNZuvMflygW5tiKVhA9CzBDDr EwsinrnglEJBWUAGah/8orLPh7yZEiAKGgrQCLqIhawknBK0vFZon3cXJzjqLfoF8RDH yG135XsmvZu1tI9vifoL7WgJ794wrGibR0E+N6PP59bpKPx6rbq3ninbaq/Ao+7duuhq GY+pLy/7LKLc+enuiDd+gBZJHIz8vtV9qRRkijH8nOMNrxlJqghtFBHpF1LWozBllea+ QkRp7xU+UXw3eA/qxdfsiIqNhJyjpEsmYvSBnc7fRzFOwcGMLl7SFasdzhFS69vqZEbc 1fLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=UWnzf5Oe; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from aserp2120.oracle.com (aserp2120.oracle.com. [141.146.126.78]) by mx.google.com with ESMTPS id k20-v6si12820625pgh.168.2018.10.15.20.10.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Oct 2018 20:10:27 -0700 (PDT) Received-SPF: pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) client-ip=141.146.126.78; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=UWnzf5Oe; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 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 (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9G38V3G053356; Tue, 16 Oct 2018 03:10:26 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=9TmCiNqyohhxt1dJj5u/Q03E/B3TZZ5o2UAiPujWx+4=; b=UWnzf5OetYhC/N6GwSnj1SwvwpGgZ0AFuFI2wZpc6uC4WTdAGlH7iw5f6ZRhkPEODcqv 3ERpdeuEP+L7K4svdepRObSCSAY/7fGo8TBTHmXfT4LH0maD8DtSDjdifuccoelVV3o8 jnoWlx+PAJnPwmYyXkDTfQkoWuEZczQxUsGiA0VErwK8tfqx5WcEtr2RRSV0hXx74h2m 9C3yAL9G/fO8UxJwVLqwzawzA3z1k15XoLr1RL4w8m7YXk3VWCbe8rarzCQV56obsRoc W1crIkRzCw8lWOxJYdJu2Z+60xPpdc19vh1015s+ZuYO9FTdiK+43tbrZ7h9vN4YXMTi Qg== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2n38npwuv7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Oct 2018 03:10:26 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9G3APWh028429 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Oct 2018 03:10:25 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9G3APO0002366; Tue, 16 Oct 2018 03:10:25 GMT Received: from localhost (/10.159.227.150) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 15 Oct 2018 20:10:25 -0700 Subject: [PATCH 04/26] 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, ocfs2-devel@oss.oracle.com Date: Mon, 15 Oct 2018 20:10:23 -0700 Message-ID: <153965942391.1256.1491987046439132016.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=544 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 If a remap caller asks us to remap to the source file's EOF and the source file has zero bytes, 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. */