Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1676715pxb; Thu, 7 Oct 2021 12:39:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgDDpHOL6nv65P7YtchRimcMAqfZEihH1lkviFpXy8DSssDD3jPO9/E5h8M40IYAoFp2On X-Received: by 2002:a17:90b:3504:: with SMTP id ls4mr6786224pjb.111.1633635584231; Thu, 07 Oct 2021 12:39:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1633635584; cv=pass; d=google.com; s=arc-20160816; b=zawLc1Ctt5uqpMSaiaYoz609igKIOF5ZdvTF1aJ5B5LOZ4R/cr0C5jI6aqGIFzfdsu hvMuPmx5cxJaCe1SPsuzQBOS2rssZXRectGZmqBEDCdUkbyRWwRe0VvWRTEDqWopRyl1 tkw3U5gJCSoWD5/hQcaKD8/g/XKavvYBCQfdOhDuSkSyPu6nPRmqvJE9A/V4t1VbKAbw ekMciIhQ274x8PLAutoNSdZZlC8OBIxIqic7z3nAG3kMIPNXvnMKAGEDIucM+c4vF5cH yDnmB8/6nC2IQwCLOqwzvLvvopvTAZPUdQpyoY40MfOvbO4PssTFEdZjfQsi6p8703O1 XPXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:importance:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:cc:to :reply-to:from:date:dkim-signature; bh=xzGQg15CyPL9rja2MEzz8Q9NJqJTQGoAsftMpINsBoE=; b=ylGHlTpGSr/u8QIEyoqRe3y6jY6D5jqElW+XuhWEiZ37Gn+IKyX0fA8eYCThlNuKRL hi0OfIo4oXd7ZgypwAsZ4es/9sf/soy5hc+3z+AhX3rTBR6JFLK87SFjzypoDiQ4iPFl psRYdDgIjwTI5/bwLeZsmNa87J/vjwcL57S/0WO1QkKtV1UtBOEx8fxtm0lun6Ha62Jr DIBehzSzfEm76BviKz7Ge3NkHBzIzmqAQoSwgYm1oHyv76/x7li8QjG3Gif1akaFr5jD XjNdhBMGPhK3269vvnKhPYt7mvwSZ4gbuuhaCXvwP/n064NxUcUR/cqX9sTjkX2VWs/Z vJ7g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=KP6fJyBu; 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 8si369603pji.166.2021.10.07.12.39.30; Thu, 07 Oct 2021 12:39:44 -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=KP6fJyBu; 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 S242228AbhJGO46 (ORCPT + 99 others); Thu, 7 Oct 2021 10:56:58 -0400 Received: from sender2-pp-o92.zoho.com.cn ([163.53.93.251]:25387 "EHLO sender2-pp-o92.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242165AbhJGO45 (ORCPT ); Thu, 7 Oct 2021 10:56:57 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1633618471; cv=none; d=zoho.com.cn; s=zohoarc; b=HuRRC8o89jqXdAXVbjrxVI1PAXvlKBSNAc+uNFZjL2NgJJTRuAhMHQxm4V9zSoRmmCFC5iHxRFzT5VHy1kRI2Rdytn8jdGPewcR+jvZ9H3d759zvHDHmOiOqoTR5lAM1uD04z6rPgngkAHul2qsM9DRxYjnTXbyycX+G1fppE38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1633618471; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:Reply-To:References:Subject:To; bh=xzGQg15CyPL9rja2MEzz8Q9NJqJTQGoAsftMpINsBoE=; b=WGmzFrbfmQPRYihO2XT6A4obP8SSizg2eO7aXYZ1cZxNd2AxW6PRIlKd+JdVNiTBtVhkDVEvDOXwFaenP/ibpKtrux5PI1lKI/ORV7o6zRFrpDtoy0XefjTRYQhf7x5QoucpNDy7+qJ5y+/9fjXMgvqoCM7hP90+P4t0WaHnz78= 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=1633618471; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=Date:From:Reply-To:To:Cc:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=xzGQg15CyPL9rja2MEzz8Q9NJqJTQGoAsftMpINsBoE=; b=KP6fJyBuyrfbQcekxkh1j/JZXkWMrHSdsD/B/proBGV6DZaJr0WaNpP+ivrlB3FB uqoxOXLxitTySKnSebFh/tFElyQFKXI02/LJuaCLihozAgwoScjnoQ9KbfmNhBDAxDj CDizZCMUBEJDJXED9RNG8bD69lfU39zVPicganJ8= Received: from mail.baihui.com by mx.zoho.com.cn with SMTP id 1633618469389517.6363333473703; Thu, 7 Oct 2021 22:54:29 +0800 (CST) Date: Thu, 07 Oct 2021 22:54:29 +0800 From: Chengguang Xu Reply-To: cgxu519@mykernel.net To: "Jan Kara" Cc: "miklos" , "amir73il" , "linux-fsdevel" , "linux-unionfs" , "linux-kernel" Message-ID: <17c5b3fa20a.ff02131b26074.9058176981832458952@mykernel.net> In-Reply-To: <20211007144156.GK12712@quack2.suse.cz> References: <20210923130814.140814-1-cgxu519@mykernel.net> <20210923130814.140814-7-cgxu519@mykernel.net> <20211007090157.GB12712@quack2.suse.cz> <17c5ab83d6d.10cdb35ab25883.3563739472838823734@mykernel.net> <20211007144156.GK12712@quack2.suse.cz> Subject: Re: [RFC PATCH v5 06/10] ovl: implement overlayfs' ->write_inode operation MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: ZohoCN Mail X-Mailer: ZohoCN Mail Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ---- =E5=9C=A8 =E6=98=9F=E6=9C=9F=E5=9B=9B, 2021-10-07 22:41:56 Jan Kara <= jack@suse.cz> =E6=92=B0=E5=86=99 ---- > On Thu 07-10-21 20:26:36, Chengguang Xu wrote: > > ---- =E5=9C=A8 =E6=98=9F=E6=9C=9F=E5=9B=9B, 2021-10-07 17:01:57 Jan K= ara =E6=92=B0=E5=86=99 ---- > > >=20 > > > > + if (mapping_writably_mapped(upper->i_mapping) || > > > > + mapping_tagged(upper->i_mapping, PAGECACHE_TAG_WRITEBACK= )) > > > > + iflag |=3D I_DIRTY_PAGES; > > > > + > > > > + iflag |=3D upper->i_state & I_DIRTY_ALL; > > >=20 > > > Also since you call ->write_inode directly upper->i_state won't be = updated > > > to reflect that inode has been written out (I_DIRTY flags get clear= ed in > > > __writeback_single_inode()). So it seems to me overlayfs will keep = writing > > > out upper inode until flush worker on upper filesystem also writes = the > > > inode and clears the dirty flags? So you rather need to call someth= ing like > > > write_inode_now() that will handle the flag clearing and do writeba= ck list > > > handling for you? > > >=20 > >=20 > > Calling ->write_inode directly upper->i_state won't be updated, howeve= r, > > I don't think overlayfs will keep writing out upper inode since > > ->write_inode will be called when only overlay inode itself marked dir= ty. > > Am I missing something? >=20 > Well, if upper->i_state is not updated, you are more or less guaranteed > upper->i_state & I_DIRTY_ALL !=3D 0 and thus even overlay inode stays di= rty. > And thus next time writeback runs you will see dirty overlay inode and > writeback the upper inode again although it is not necessary. >=20 Hi Jan, Yes, I get the point now. Thanks for the explanation. Thanks, Chengguang