From patchwork Sun Dec 2 01:07:49 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: 10707889 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 A3ECC1579 for ; Sun, 2 Dec 2018 08:04:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 991572A04E for ; Sun, 2 Dec 2018 08:04:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C7252A1EC; Sun, 2 Dec 2018 08:04:46 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D1C62A04E for ; Sun, 2 Dec 2018 08:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725764AbeLBIEm (ORCPT ); Sun, 2 Dec 2018 03:04:42 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:56730 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbeLBIEm (ORCPT ); Sun, 2 Dec 2018 03:04:42 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wB2143IS159415; Sun, 2 Dec 2018 01:07:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=X+LIlU796i5bR95h5NtIERThpiq8aeGsIw89yZAngxk=; b=T6AEDOUxSY7/rP4NjXFaBMnHBZugpK0SJWL53+fldvEssc2Z4aN1wzXEyKLkpfGfspDg a5aPXrJna7DZEsKVUyOvF6AB+XZI6onGayXOsG61Tn9JJMCWE+si7O95sZoZ/RFxuNkB geWSYTbJrQa33BPcM8tIAIadCnp8urNjhy8FikBPeao+pOfr57ktf6zUkj8jX7+sat4G /DFivO41RQBrlzLR6b/HAUey/ow9rMj/jz94lndTeaCiFSXFE5TELP1RyTbhg5XKXfdx wPQm1HCY7Swyy3KA9m/v3wKisalXLcVDr4uCYtw4IVcvqZ3UpHQDhazriaOPG0ifBUGI mA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2p3hqthup7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 02 Dec 2018 01:07:57 +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 wB217pan012134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 2 Dec 2018 01:07:51 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wB217oYV007639; Sun, 2 Dec 2018 01:07:51 GMT Received: from localhost (/10.159.134.129) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 01 Dec 2018 17:07:50 -0800 Date: Sat, 1 Dec 2018 17:07:49 -0800 From: "Darrick J. Wong" To: Dave Chinner Cc: xfs , linux-fsdevel , amir73il@gmail.com, linux-unionfs@vger.kernel.org Subject: [PATCH v2] vfs: allow some remap flags to be passed to vfs_clone_file_range Message-ID: <20181202010749.GQ8125@magnolia> References: <20181130204238.GE8131@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20181130204238.GE8131@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9094 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=866 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812020008 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong In overlayfs, ovl_remap_file_range calls vfs_clone_file_range on the lower filesystem's inode, passing through whatever remap flags it got from its caller. Since vfs_copy_file_range first tries a filesystem's remap function with REMAP_FILE_CAN_SHORTEN, this can get passed through to the second vfs_copy_file_range call, and this isn't an issue. Change the WARN_ON to look only for the DEDUP flag. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein --- fs/read_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/read_write.c b/fs/read_write.c index 4dae0399c75a..58f30537c47a 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1956,7 +1956,7 @@ loff_t do_clone_file_range(struct file *file_in, loff_t pos_in, struct inode *inode_out = file_inode(file_out); loff_t ret; - WARN_ON_ONCE(remap_flags); + WARN_ON_ONCE(remap_flags & REMAP_FILE_DEDUP); if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode)) return -EISDIR;