From patchwork Wed Oct 24 19:58:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 10654945 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 E01F914E2 for ; Wed, 24 Oct 2018 19:58:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF8C82AFE3 for ; Wed, 24 Oct 2018 19:58:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C332B2AFD5; Wed, 24 Oct 2018 19:58:48 +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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 781482AFD5 for ; Wed, 24 Oct 2018 19:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727401AbeJYE2N (ORCPT ); Thu, 25 Oct 2018 00:28:13 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:43892 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726221AbeJYE2M (ORCPT ); Thu, 25 Oct 2018 00:28:12 -0400 Received: by mail-qt1-f195.google.com with SMTP id q41-v6so7084597qtq.10; Wed, 24 Oct 2018 12:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hvO97r38odejQD2UfpD/KDSrWr7Es3ZRdoL6dlpHDTY=; b=aFxrcAIXBS51Bj+q9TQcW8dj9mo2rrJjRWQXewjiRr0pJF7s6j4jkxEuQCAk0OQhOc ER+6gI3kjTmw+XdK8pFgp3OGgaFNOi6X8dMX2469hpONwENS0X12Ig5o9oDORTj1hhiX XReEwM58MpncFcWKGw5XBO5zRuY13I6kL+/0CnjsUvYIZ/Cl5754hoi9gF/bxvl7XAfH rd08KTg/PrVOxHR6zGEX9ZVlUjY+oddzNgh5lJSgfs4ztPwuq78pC6kOVodpH+lZ/r5A m2gEx9mBokMLbRJBiv9rM+H78h7ibikf/jM9VCPu8A3XhScjHC7ZzrQgGFEV4BS/akOf Ieyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hvO97r38odejQD2UfpD/KDSrWr7Es3ZRdoL6dlpHDTY=; b=ptk/+sSYhrL6eSy1F55IgnMRhe35qjIuGi/y34iL07wG6R5bs3Vj/fQG5PeO0YEyoT LGxp8K/xTXzHyMXN58cyduFwv7U9OPaVU3NIeYaQ7oK3T1/8b+H2QdonQVhABGWdXnYH zUFuAzvU3kdFQcYxUYx+Nut4Nzbg5Y6nmkp5CM/2Ii57h04UyjhHmOErQZVr0czmw5/n xGLyAxAfKdyGOAmqrq6sXR8TIgKW8MxH9d6nrImyzbBT9ioXlkDDNCwVm6kKeKrkpXiI Y0pXx6iE/D0v6OmNQg7iPIQ5Ijc9wr6sdOkoF66M5Ro3n8Oe78wNbn/2LMCnXF8khl4B leRg== X-Gm-Message-State: AGRZ1gJilqqrP6qKUftYNRFhtAu6FLj9kZvDSmPEDyOjqLeHz3TMgWVF jUJgaCESVPqBwxYELrqegbc= X-Google-Smtp-Source: AJdET5dbTi5HYhRU2qJEDRaB8vr13zxgOKCgdIoY0lf9m5ntYBC41ytTdxtn6jR97Xeb7hyIifvHYA== X-Received: by 2002:ac8:33ad:: with SMTP id c42-v6mr3849722qtb.190.1540411125567; Wed, 24 Oct 2018 12:58:45 -0700 (PDT) Received: from Olgas-MBP-195.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id d124-v6sm3872380qkf.85.2018.10.24.12.58.44 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 24 Oct 2018 12:58:45 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, viro@zeniv.linux.org.uk, smfrench@gmail.com, miklos@szeredi.hu Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-man@vger.kernel.org Subject: [PATCH v2 03/13] OverlayFS: add cross-device check for copy_file_range Date: Wed, 24 Oct 2018 15:58:27 -0400 Message-Id: <20181024195837.35532-5-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: <20181024195837.35532-1-olga.kornievskaia@gmail.com> References: <20181024195837.35532-1-olga.kornievskaia@gmail.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Olga Kornievskaia VFS copy_file_range was relaxed to allow for cross-device copy. Add a check for now, to disallow cross-device copy offload until appropriate support is added. Signed-off-by: Olga Kornievskaia ` Reviewed-by: Amir Goldstein --- fs/overlayfs/file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index aeaefd2..5282853 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -483,6 +483,9 @@ static ssize_t ovl_copy_file_range(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, size_t len, unsigned int flags) { + if (file_in->f_inode->i_sb != file_out->f_inode->i_sb) + return -EXDEV; + return ovl_copyfile(file_in, pos_in, file_out, pos_out, len, flags, OVL_COPY); }