Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1047981ybp; Thu, 17 Oct 2019 07:19:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyWRYePiVySFvctbvghsCj9e3nygew4CsjO05CkIA4W2tfhdTwTzcjog1mMBaOXJDxiJ+F X-Received: by 2002:a17:906:b245:: with SMTP id ce5mr3737828ejb.52.1571321990652; Thu, 17 Oct 2019 07:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571321990; cv=none; d=google.com; s=arc-20160816; b=MpQFIhZ8IFP3X77ZLFzthdAzOlrMMBBrH63YQqy1pbE7XAfy/lAyKgDqzn8fPWabhH wYG1FtoGcSAV0V4f3+u71G7UrhU8EnrCTCJHs9jpNEaYxxLFK75lj4ynppvUZ+HkuoXB UZdX/3BuolWUi7HLLYdtGSQiezbqAsQ9yasqa5QfyJHz/TEBPdgleG+jAm2SnjppsmYU 4b+wG5zfPFAni7BdPPoRNZdSmtEvOLU55wPld0192GvUtUiKqQqoYdrW93nk3xLriSk0 XJmWuNzYXu1HXReQfoYHJM3eLTOWhAv+X0XAXGbZfw5Vpbq5Fc7gLd5ZQaVYotI6VWeP YT1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nLdeDYI3CZ2uuURtRtuLeMziXEDWm4ffunfAVtw6e4U=; b=Lt3ktWbP3S49JvrBc8LfrSlYtlwzSrBf5VeFD+bHfiJab5zvtAJz1/TNPLomoCHD3I Ge7wRXjfnGjjCp3okAgx5IIIhRTidh1z1qLrUN6BN5C5EnY5/H0ZoAPXsckO3sMdtQZX djpHFm5AS2GKhNx64HpetMlkANozW7nwNc8MTwSsDRrnjuRvwFvskkVS4EfKjLW1TmWd hloyTdmjbJSaX0iNlWGP5XKoOKI3hHRr0iQKCQyzopX79InPGt1uTaPRbfxfTroBlJIu wy1dwvVX+b8Kkq0Zfk/vkkK5gyk4bYQx304z0myC8Xgcg6VRZQsvNIjE+3jxl1pGbHHo ZoBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pWtfigqn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nl6si1368182ejb.207.2019.10.17.07.19.27; Thu, 17 Oct 2019 07:19:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pWtfigqn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394991AbfJPVyZ (ORCPT + 99 others); Wed, 16 Oct 2019 17:54:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:43850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437700AbfJPVyL (ORCPT ); Wed, 16 Oct 2019 17:54:11 -0400 Received: from localhost (unknown [192.55.54.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C54D2218DE; Wed, 16 Oct 2019 21:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571262851; bh=2i8+d2TT3yX8/1+HhuIWKqY7fbcAmg4UD+/uh4pIKuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pWtfigqn0yS+IwShFbbfKTy4NDeKwmAKt2pGrS0aEIFdl5y29oSDFSkkfogaJchg9 cXENLzmnM781neTXsGwpkDPDTByJUeWvICf9pjs+DSiLME1QJYvHbyqCFXiqEKuBSu 512uy/VqCQJnboss8ml0MPICTsTJs7OXUSmnPylI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengguang Xu , Dominique Martinet , Sasha Levin Subject: [PATCH 4.9 17/92] 9p: avoid attaching writeback_fid on mmap with type PRIVATE Date: Wed, 16 Oct 2019 14:49:50 -0700 Message-Id: <20191016214815.045948092@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214759.600329427@linuxfoundation.org> References: <20191016214759.600329427@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chengguang Xu [ Upstream commit c87a37ebd40b889178664c2c09cc187334146292 ] Currently on mmap cache policy, we always attach writeback_fid whether mmap type is SHARED or PRIVATE. However, in the use case of kata-container which combines 9p(Guest OS) with overlayfs(Host OS), this behavior will trigger overlayfs' copy-up when excute command inside container. Link: http://lkml.kernel.org/r/20190820100325.10313-1-cgxu519@zoho.com.cn Signed-off-by: Chengguang Xu Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin --- fs/9p/vfs_file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 79ff727254bb6..e963b83afc717 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -528,6 +528,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma) v9inode = V9FS_I(inode); mutex_lock(&v9inode->v_mutex); if (!v9inode->writeback_fid && + (vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_WRITE)) { /* * clone a fid and add it to writeback_fid @@ -629,6 +630,8 @@ static void v9fs_mmap_vm_close(struct vm_area_struct *vma) (vma->vm_end - vma->vm_start - 1), }; + if (!(vma->vm_flags & VM_SHARED)) + return; p9_debug(P9_DEBUG_VFS, "9p VMA close, %p, flushing", vma); -- 2.20.1