Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2074693ybp; Thu, 10 Oct 2019 01:43:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHQk2WG4VvEGohEcS4vKdzMCpEfILQcMA1PGW7U2idUvamv6D/ekgKJoojDZLvY48HG0Mg X-Received: by 2002:a17:906:5007:: with SMTP id s7mr7044760ejj.181.1570697026892; Thu, 10 Oct 2019 01:43:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697026; cv=none; d=google.com; s=arc-20160816; b=RRAD0daijUZBVWy6LJDixribguA1fv8nTxVObT8MnLGNQTSy7/Rcfx0MvW3l0ywkfI o9yY2xQEQnhurGVa7E47DWCD13nZyNqfQvVwI3HaF5ut1gNa8mLUWo98A+eCJqfbQ7wP FPe28F4jJoY1/+CHBIQrcauwFgixlgQnr/OHcX2ADek83RXQKOkydJmnzvCfLOptk6MK HkxcuEVQqWDfOk+XwbgkI3u0UD4O17M95TAxKDwbiGaFjo96WwAf6RTbXREGUf+1fdok HuHT+I4YfK4JmKwSpUYiDXvXarhKpKY+lK0aWXjvZByI6s6JfCXf4PVqy5X6oTgBOqDC ETQw== 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=65UgfK4DjAN3BoixngBzwtgMuxcoQH83PDSVGNjM/e8=; b=XPt8FYgN3HgVzs1EuRxgbS4MZNeoBdBzNr2haIREPMCkFVs+wwVWejlku/+98Iwc3n c9AK1ONNxpeaWqlAuJzq2LKOMwi2cFzzjSWlOe9IXwRn2ad7DrObw8VyfvL7lxB++on3 YW119mKwcikNqTaVAq0LgyNEt/YbnKT6dPxLCKVneWkRyjMid4SdWscWNfGu+oG0Vkrs eOa8ll3EiCrz8rH1uM7M3UM6OZhP14aX5tMqzS2wurATIaTqTYcWp1Qr7PNFAdQf4sji B1bWq5u3ihcQXwj6YnIMmqY9EK4InW/bHgkLZOCqcVD/l1cTtHGDiTRCsMpsse47SK/q RF2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NYi+1K+i; 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 e4si2759889edy.295.2019.10.10.01.43.24; Thu, 10 Oct 2019 01:43:46 -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=NYi+1K+i; 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 S2387711AbfJJIlp (ORCPT + 99 others); Thu, 10 Oct 2019 04:41:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:46160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388383AbfJJIll (ORCPT ); Thu, 10 Oct 2019 04:41:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 888812054F; Thu, 10 Oct 2019 08:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696901; bh=kjBBx1owjHoHOHK+PfnP7vwaB5MJ/Cp+vuwoeSfQum4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NYi+1K+i+QfW6NbtVQGi50s5uI5KdhlkmLeyXnvS+NWXyEapPFPmiezEWz7RNjBVB +Lrq0+uOVdrrLG7Lo9RwJB3vIgXcMRMn9aNFb1GtSeZp9jJSnV08u8HSYzx++ptKJ/ hTu1CHJVfccf0cynC/qNqn5ii0BAhcmYcA6IIYs8= 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 5.3 095/148] 9p: avoid attaching writeback_fid on mmap with type PRIVATE Date: Thu, 10 Oct 2019 10:35:56 +0200 Message-Id: <20191010083617.043759883@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@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 4cc966a31cb37..fe7f0bd2048e4 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -513,6 +513,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 @@ -614,6 +615,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