[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <17c5b3fa20a.ff02131b26074.9058176981832458952@mykernel.net>
Date: Thu, 07 Oct 2021 22:54:29 +0800
From: Chengguang Xu <cgxu519@...ernel.net>
To: "Jan Kara" <jack@...e.cz>
Cc: "miklos" <miklos@...redi.hu>, "amir73il" <amir73il@...il.com>,
"linux-fsdevel" <linux-fsdevel@...r.kernel.org>,
"linux-unionfs" <linux-unionfs@...r.kernel.org>,
"linux-kernel" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v5 06/10] ovl: implement overlayfs' ->write_inode
operation
---- 在 星期四, 2021-10-07 22:41:56 Jan Kara <jack@...e.cz> 撰写 ----
> On Thu 07-10-21 20:26:36, Chengguang Xu wrote:
> > ---- 在 星期四, 2021-10-07 17:01:57 Jan Kara <jack@...e.cz> 撰写 ----
> > >
> > > > + if (mapping_writably_mapped(upper->i_mapping) ||
> > > > + mapping_tagged(upper->i_mapping, PAGECACHE_TAG_WRITEBACK))
> > > > + iflag |= I_DIRTY_PAGES;
> > > > +
> > > > + iflag |= upper->i_state & I_DIRTY_ALL;
> > >
> > > 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 cleared 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 something like
> > > write_inode_now() that will handle the flag clearing and do writeback list
> > > handling for you?
> > >
> >
> > Calling ->write_inode directly upper->i_state won't be updated, however,
> > I don't think overlayfs will keep writing out upper inode since
> > ->write_inode will be called when only overlay inode itself marked dirty.
> > Am I missing something?
>
> Well, if upper->i_state is not updated, you are more or less guaranteed
> upper->i_state & I_DIRTY_ALL != 0 and thus even overlay inode stays dirty.
> And thus next time writeback runs you will see dirty overlay inode and
> writeback the upper inode again although it is not necessary.
>
Hi Jan,
Yes, I get the point now. Thanks for the explanation.
Thanks,
Chengguang
Powered by blists - more mailing lists