Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp571391pxb; Thu, 23 Sep 2021 06:26:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3ZyAGei8aK5n9TNes4lT33d/WbUFfKiL1HVhN806A4mla9nTr9gk1dNmwfLYbMVaZr4bc X-Received: by 2002:a17:906:3486:: with SMTP id g6mr5095879ejb.71.1632403575327; Thu, 23 Sep 2021 06:26:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1632403575; cv=pass; d=google.com; s=arc-20160816; b=i1G9pN+7wzDG/0+O1JBxLVbt4JqgFLPHuybC8H73y6oINF+UGlOTh9+/7TsV7xn8oc OOTKg1VL1Adz7nM9lQK0DlfN3ewIrvc8uz78I4btxvKy6I+IG7Cns+leLuDZKkwNVH7i bUpNESn4YXXRTpuPXfaGeyt5gPxYgAQ8ea44BStv8IO7UPKH1rIwAe5LLsDnI0H4QF4z E+CJeijRHwDCk1+9epFgyMukUyehUCdiw1K+69ezZ+zBPYV2zG5eGtv6fdgeJ7e3GCO9 P7TtZNP2iGBfpsKycfZ6YOKHij4K/6lrRIbc6/3HHenExVQ15SjQrs6kLi8Kf2WCxCSB x4oQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:subject:message-id:cc:to:from :dkim-signature; bh=q/ZniZvEQNR9QMjyUGnqhtU4K3+28Lsctqx6fnG5LiE=; b=HmsH282P2SHuVTUIupc6jkWOkS8TeqGxj8zGHAZOUvBDdd7m5395wXRZULkNDTN7c+ VSV4GiGXS4OA//yvkp4Lc6HispsOnPxvILRO8vHwXmN64bJ4Yx3tKgpKqoBcgdjv6w1T skzipN4i7yWi5VjdQt6JVy6UI43RWEbsvVZChohIFLofJNt2/vRRjWNm58AvbkWhWbYz wXkELoMexGRy8qOSQL+LtCct6FtUQ0HkXQ6+mkggf0XmNou6AoEEO1GdJKZHmjnjyK5e jMS0wEA2SVw0QcymXNCEStV4EzPhZuE7KfsVnP2mxMAjYGi4heXOcGPXzjqrqppGkUrv lM6Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=NjilX8d3; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si5979113ejy.322.2021.09.23.06.25.50; Thu, 23 Sep 2021 06:26:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=NjilX8d3; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241354AbhIWNZt (ORCPT + 99 others); Thu, 23 Sep 2021 09:25:49 -0400 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17278 "EHLO sender2-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241308AbhIWNZn (ORCPT ); Thu, 23 Sep 2021 09:25:43 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1632402521; cv=none; d=zoho.com.cn; s=zohoarc; b=L1v9aJ10+Cg+LJ2ZbCif6XWkIptsXu5lucWEt9Drkp7JdZm2GH2N3moGZSN4HNHglwtPFxKR0ZC924CsoeSGbDxEERGuzuzacIw8/K9Ud97EzMc8EaNHOskbFrWQ6hir/zsNhFaVeXx6a7ijPyA4Z95OWYIOZtMuKNzoI3Tn2rI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1632402521; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=q/ZniZvEQNR9QMjyUGnqhtU4K3+28Lsctqx6fnG5LiE=; b=PMxgor99S9g4BKqAeG9F1Y6buycIqPC3U2jAPE2XStUZ6CtxFnQ7j1FDqxOcBrR06A0h//j9KFoAuctOxcnz1RYuwHaVJN7W8YWryu34Yqvxa6rOqhZtolUhU0EZvnhXFbTv2gD6gSuVVyXTIp1FEO19WPU1W/xfyz50sejlSl4= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1632402521; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=q/ZniZvEQNR9QMjyUGnqhtU4K3+28Lsctqx6fnG5LiE=; b=NjilX8d3wa3bTRR0ftONhPLUW3ClZ4ZT4AjNY4/G9Oy5qIE+SArx5y0AzSdNTT6x ATqxD5vlusfbfeb4Z4pfMUgsyDMTC9KcCSm80guqKs8g/o2cESFeqSAJfEdH60RjOmr /pPXXKKbPBWvsE5apRv+4jbUzUg0mJFAQrfE8rO0= Received: from localhost.localdomain (81.71.33.115 [81.71.33.115]) by mx.zoho.com.cn with SMTPS id 163240251969041.52353362646056; Thu, 23 Sep 2021 21:08:39 +0800 (CST) From: Chengguang Xu To: miklos@szeredi.hu, jack@suse.cz, amir73il@gmail.com Cc: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org, Chengguang Xu Message-ID: <20210923130814.140814-6-cgxu519@mykernel.net> Subject: [RFC PATCH v5 05/10] ovl: mark overlayfs' inode dirty on shared mmap Date: Thu, 23 Sep 2021 21:08:09 +0800 X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210923130814.140814-1-cgxu519@mykernel.net> References: <20210923130814.140814-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Overlayfs cannot be notified when mmapped area gets dirty, so we need to proactively mark inode dirty in ->mmap operation. Signed-off-by: Chengguang Xu --- fs/overlayfs/file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index d081faa55e83..f9dc5249c183 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -482,6 +482,12 @@ static int ovl_mmap(struct file *file, struct vm_area_= struct *vma) =09revert_creds(old_cred); =09ovl_file_accessed(file); =20 +=09if (!ret) { +=09=09if (ovl_inode_upper(file_inode(file)) && +=09=09 vma->vm_flags & VM_SHARED) +=09=09=09ovl_mark_inode_dirty(file_inode(file)); +=09} + =09return ret; } =20 --=20 2.27.0