[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <17c5adfe5ea.12f1be94625921.4478415437452327206@mykernel.net>
Date: Thu, 07 Oct 2021 21:09:55 +0800
From: Chengguang Xu <cgxu519@...ernel.net>
To: "Miklos Szeredi" <miklos@...redi.hu>
Cc: "Jan Kara" <jack@...e.cz>, "Amir Goldstein" <amir73il@...il.com>,
"linux-fsdevel" <linux-fsdevel@...r.kernel.org>,
"overlayfs" <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 20:45:20 Miklos Szeredi <miklos@...redi.hu> 撰写 ----
> On Thu, 7 Oct 2021 at 14:28, Chengguang Xu <cgxu519@...ernel.net> wrote:
> >
> > ---- 在 星期四, 2021-10-07 17:23:06 Miklos Szeredi <miklos@...redi.hu> 撰写 ----
> > > On Thu, 23 Sept 2021 at 15:08, Chengguang Xu <cgxu519@...ernel.net> wrote:
> > > >
> > > > Implement overlayfs' ->write_inode to sync dirty data
> > > > and redirty overlayfs' inode if necessary.
> > > >
> > > > Signed-off-by: Chengguang Xu <cgxu519@...ernel.net>
> > > > ---
> > > > fs/overlayfs/super.c | 30 ++++++++++++++++++++++++++++++
> > > > 1 file changed, 30 insertions(+)
> > > >
> > > > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> > > > index 2ab77adf7256..cddae3ca2fa5 100644
> > > > --- a/fs/overlayfs/super.c
> > > > +++ b/fs/overlayfs/super.c
> > > > @@ -412,12 +412,42 @@ static void ovl_evict_inode(struct inode *inode)
> > > > clear_inode(inode);
> > > > }
> > > >
> > > > +static int ovl_write_inode(struct inode *inode,
> > > > + struct writeback_control *wbc)
> > > > +{
> > > > + struct ovl_fs *ofs = inode->i_sb->s_fs_info;
> > > > + struct inode *upper = ovl_inode_upper(inode);
> > > > + unsigned long iflag = 0;
> > > > + int ret = 0;
> > > > +
> > > > + if (!upper)
> > > > + return 0;
> > > > +
> > > > + if (!ovl_should_sync(ofs))
> > > > + return 0;
> > > > +
> > > > + if (upper->i_sb->s_op->write_inode)
> > > > + ret = upper->i_sb->s_op->write_inode(inode, wbc);
> > >
> > > Where is page writeback on upper inode triggered?
> > >
> >
> > Should pass upper inode instead of overlay inode here.
>
> That's true and it does seem to indicate lack of thorough testing.
It's a little bit weird this passed all overlay cases and generic/474(syncfs) without errors in xfstests.
Please let me do more diagnosis on this and strengthen the test case.
>
> However that wasn't what I was asking about. AFAICS ->write_inode()
> won't start write back for dirty pages. Maybe I'm missing something,
> but there it looks as if nothing will actually trigger writeback for
> dirty pages in upper inode.
>
Actually, page writeback on upper inode will be triggered by overlayfs ->writepages and
overlayfs' ->writepages will be called by vfs writeback function (i.e writeback_sb_inodes).
Thanks,
Chengguang
Powered by blists - more mailing lists