lkml.org 
[lkml]   [2021]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v5 06/10] ovl: implement overlayfs' ->write_inode operation
On Thu 07-10-21 20:26:36, Chengguang Xu wrote:
> ---- 在 星期四, 2021-10-07 17:01:57 Jan Kara <jack@suse.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.

Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR

\
 
 \ /
  Last update: 2021-10-07 16:42    [W:1.641 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site