From patchwork Sun Oct 21 16:15: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: 10650947 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 0101C14E2 for ; Sun, 21 Oct 2018 16:15:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E36BA287BE for ; Sun, 21 Oct 2018 16:15:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7285287C6; Sun, 21 Oct 2018 16:15:29 +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 7E290287BE for ; Sun, 21 Oct 2018 16:15:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DF126B0008; Sun, 21 Oct 2018 12:15:28 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 98F0B6B000C; Sun, 21 Oct 2018 12:15: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 87D936B000D; Sun, 21 Oct 2018 12:15:28 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yw1-f69.google.com (mail-yw1-f69.google.com [209.85.161.69]) by kanga.kvack.org (Postfix) with ESMTP id 5B36D6B0008 for ; Sun, 21 Oct 2018 12:15:28 -0400 (EDT) Received: by mail-yw1-f69.google.com with SMTP id 191-v6so25608012ywg.10 for ; Sun, 21 Oct 2018 09:15: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=6r7g0KcDO4x0ZJm4RBSdxfhsKMbYQWElnIgn2PkV3NQ=; b=gPJyGuW8qt9S/+xqj3LNfJFKG4tltpbVkAltYu/d0eo0a33HGqF9971dGVaz1ITfEa WiKNISBjNISxvXXM4znl+R9AIUcWttWrmh5dvwJOvvlp0x0OZEQ8aBsrrO+8E9gEEQxk Ht/fGiR/JyAnTmdHN4N7c68x0y5L00DCcCAMh/k95GXqXRbnaMCAxaVXcbg8t30m8JTb j6GGy0UAN1UL7u06j3qvcng678Z5FcN/bDtW3OoFmBYvrwGx92QMLUr9jmTfKf6ojgHx RoxGhqdTmB9wkc8Sx2dKO3F9RqzYOPNBjBZGU472GqzDck+gzxJPww6Fcn1v+yY2dhzW lptg== X-Gm-Message-State: ABuFfogJRe72wPm4OB1kTaaLluRGwvRG7iCVxsn6MIJM3kp7aUnZmWF1 zdZQObRkphbWxgnLSfwDtJ9MiFsrXC2ZrxHIw+gcTwIoKrjBiXe8f4o/MPVKEOZQPvT1HTANnf0 meewpQn7eXdZ07wJ0cfjypxm92Y3liWykDFBALAxh09hPepLnYjKEriDd5kBOzIUTsw== X-Received: by 2002:a25:a489:: with SMTP id g9-v6mr29419922ybi.276.1540138528105; Sun, 21 Oct 2018 09:15:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV60AVoYGtPeRAIL5BsKbETZRvX3xw3wvMHw8UIIfHEemZ9dZa18M9atHT965pDNp6EVjnd1K X-Received: by 2002:a25:a489:: with SMTP id g9-v6mr29419893ybi.276.1540138527578; Sun, 21 Oct 2018 09:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540138527; cv=none; d=google.com; s=arc-20160816; b=lwSpcxhiRCpkUBYpF3kuOo+JSHKRNu+W0G/XXEadxkC3z81iXQng4NrZdctV3T4P87 DQVTAi0JGw4QwbzLJfU/lgjnLkX9l8WQaJavwbs+sRFdbe5h65r+d1APD2AvhyWPW5GP y7ypIBNZgVu+yEeNYNOJIZ0s1LK/rTt1xY546G5YEiGYkcJNYwHxjJaMZKmQaep8WaSk 3UeQGTwPX/Ws9Z3QplEywY/AoqGDuH7SOkQFKFc1iwa5JMkiy2uFPoQJsv4kvq57npbl NAyjHS79PzCtE2dMXkFS5sV//KV2wXotRboHHgXGjrIf9rOPA6oLg/pk0Pc/VcdbrgyC +0UQ== 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=r166V4QxDOwh52vhlZb3dojZ/TUsh5PKFbTfZhHK+8eTJyZhGSvTk3lgzhaOlFbO+J XI24w68w0zOkXq72l5PqeHduq1wmzqIe0BRDD84Wq1/5P2FXLGaapqFfxUUpzWfvL92h HGTZPTgIASF214fdOF5lWrVbhpGMH44SRn927IDTJ8vkx+2PLXBh7at1JtSDfD08F0aU nPp8vSwvmj6qeEh6+IHApXogNobvVpY9rYwtr3GCh5ZZrPw8bSQDq+yFeNshQGEewsY1 dTVtbVTihRnhiMFCuwhjIgW3tHPuYgs7//W9MSGrWTtAu7OJb6pKCmI5b4Q/n4ZySO4I uSeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=G4f0diKn; 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 i18-v6si1741687ywc.151.2018.10.21.09.15.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Oct 2018 09:15: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=G4f0diKn; 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 w9LGEDTG154828; Sun, 21 Oct 2018 16:15: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=6r7g0KcDO4x0ZJm4RBSdxfhsKMbYQWElnIgn2PkV3NQ=; b=G4f0diKnSZMc5xbAUGZ7NohePK4ZGjNPNIJDHxsAvb5azkZKg4DFCdiSJJ9RhGBNfp+c VOFTqhfHvBHm7lOP9wXHJaFBJCkJv7XwG0RXL55JrfMQJtEvskTmMZyP+BTzhfvKq4+l rf3lyiVpxmUxzYk7m1L50bcSkSFGvD6XoBWRZA0AUz4H+XxYSKVRolB6so2ps+KB0NIU ZaYuNHHPWYoM9jM4RiVcoKQMgRjIsB72OmNHhRy5IyhYV7ivGpw2FgCTAjf0JxHvQh/s 3xAxOT+CWaf1XOa8nAqH5BOn/gJqxVX0jtuSTaFF+2VcJqUtqLxgXkzPJcHu7ewJsAdJ Vg== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2n7vapjynj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 21 Oct 2018 16:15: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 w9LGFPbA007826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 21 Oct 2018 16:15:25 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9LGFPJ5018013; Sun, 21 Oct 2018 16:15:25 GMT Received: from localhost (/10.159.225.70) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 21 Oct 2018 09:15:25 -0700 Subject: [PATCH 03/28] 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: Sun, 21 Oct 2018 09:15:23 -0700 Message-ID: <154013852390.29026.2594942938207791308.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=703 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 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. */