From: Jan Kara <jack@suse.cz>
To: Chengguang Xu <cgxu519@mykernel.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>, amir73il <amir73il@gmail.com>,
jack <jack@suse.cz>, miklos <miklos@szeredi.hu>,
linux-unionfs <linux-unionfs@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [RFC PATCH 1/5] fs: introduce notifier list for vfs inode
Date: Fri, 16 Oct 2020 11:22:48 +0200 [thread overview]
Message-ID: <20201016092248.GK7037@quack2.suse.cz> (raw)
In-Reply-To: <175303e1d27.105ba43f146287.2025735092350714226@mykernel.net>
On Fri 16-10-20 15:09:38, Chengguang Xu wrote:
> ---- 在 星期四, 2020-10-15 12:57:41 Al Viro <viro@zeniv.linux.org.uk> 撰写 ----
> > On Thu, Oct 15, 2020 at 11:42:51AM +0800, Chengguang Xu wrote:
> > > ---- 在 星期四, 2020-10-15 11:25:01 Al Viro <viro@zeniv.linux.org.uk> 撰写 ----
> > > > On Sat, Oct 10, 2020 at 10:23:51PM +0800, Chengguang Xu wrote:
> > > > > Currently there is no notification api for kernel about modification
> > > > > of vfs inode, in some use cases like overlayfs, this kind of notification
> > > > > will be very helpful to implement containerized syncfs functionality.
> > > > > As the first attempt, we introduce marking inode dirty notification so that
> > > > > overlay's inode could mark itself dirty as well and then only sync dirty
> > > > > overlay inode while syncfs.
> > > >
> > > > Who's responsible for removing the crap from notifier chain? And how does
> > > > that affect the lifetime of inode?
> > >
> > > In this case, overlayfs unregisters call back from the notifier chain of upper inode
> > > when evicting it's own inode. It will not affect the lifetime of upper inode because
> > > overlayfs inode holds a reference of upper inode that means upper inode will not be
> > > evicted while overlayfs inode is still alive.
> >
> > Let me see if I've got it right:
> > * your chain contains 1 (for upper inodes) or 0 (everything else, i.e. the
> > vast majority of inodes) recepients
> > * recepient pins the inode for as long as the recepient exists
> >
> > That looks like a massive overkill, especially since all you are propagating is
> > dirtying the suckers. All you really need is one bit in your inode + hash table
> > indexed by the address of struct inode (well, middle bits thereof, as usual).
> > With entries embedded into overlayfs-private part of overlayfs inode. And callback
> > to be called stored in that entry...
> >
>
> Hi AI, Jack, Amir
>
> Based on your feedback, I would to change the inode dirty notification
> something like below, is it acceptable?
>
>
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 1492271..48473d9 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -2249,6 +2249,14 @@ void __mark_inode_dirty(struct inode *inode, int flags)
>
> trace_writeback_mark_inode_dirty(inode, flags);
>
> + if (inode->state & I_OVL_INUSE) {
> + struct inode *ovl_inode;
> +
> + ovl_inode = ilookup5(NULL, (unsigned long)inode, ovl_inode_test, inode);
I don't think this will work - superblock pointer is part of the hash value
inode is hashed with so without proper sb pointer you won't find proper
hash chain.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2020-10-16 9:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-10 14:23 [RFC PATCH 0/5] implement containerized syncfs for overlayfs Chengguang Xu
2020-10-10 14:23 ` [RFC PATCH 1/5] fs: introduce notifier list for vfs inode Chengguang Xu
2020-10-14 16:15 ` Jan Kara
2020-10-15 3:03 ` Chengguang Xu
2020-10-15 6:11 ` Amir Goldstein
2020-10-15 11:29 ` Chengguang Xu
2020-10-15 12:32 ` Amir Goldstein
2020-10-15 13:13 ` Chengguang Xu
2020-10-15 16:02 ` Amir Goldstein
2020-10-15 16:06 ` Amir Goldstein
2020-10-16 1:56 ` Chengguang Xu
2020-10-16 4:39 ` Amir Goldstein
2020-10-16 7:43 ` Chengguang Xu
2020-10-15 3:25 ` Al Viro
2020-10-15 3:42 ` Chengguang Xu
2020-10-15 4:57 ` Al Viro
2020-10-15 10:56 ` Chengguang Xu
2020-10-16 7:09 ` Chengguang Xu
2020-10-16 9:22 ` Jan Kara [this message]
2020-10-10 14:23 ` [RFC PATCH 2/5] fs: export symbol of writeback_single_inode() Chengguang Xu
2020-10-10 14:23 ` [RFC PATCH 3/5] ovl: setup overlayfs' private bdi Chengguang Xu
2020-10-10 14:23 ` [RFC PATCH 4/5] ovl: monitor marking dirty activity of underlying upper inode Chengguang Xu
2020-10-10 14:23 ` [RFC PATCH 5/5] ovl: impement containerized syncfs for overlayfs Chengguang Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201016092248.GK7037@quack2.suse.cz \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=cgxu519@mykernel.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).