linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Matthew Bobrowski <repnop@google.com>,
	linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: [RFC][PATCH 0/2] Monitoring unmounted fs with fanotify
Date: Tue, 18 Apr 2023 16:12:12 +0200	[thread overview]
Message-ID: <20230418-absegnen-sputen-11212a0615c7@brauner> (raw)
In-Reply-To: <CAOQ4uxj5UwDhV7XxWZ-Os+fzM=_N1DDWHpjmt6UnHr96EDriMw@mail.gmail.com>

On Tue, Apr 18, 2023 at 04:56:40PM +0300, Amir Goldstein wrote:
> On Tue, Apr 18, 2023 at 4:33 PM Christian Brauner <brauner@kernel.org> wrote:
> >
> > On Fri, Apr 14, 2023 at 09:29:01PM +0300, Amir Goldstein wrote:
> > > Jan,
> > >
> > > Followup on my quest to close the gap with inotify functionality,
> > > here is a proposal for FAN_UNMOUNT event.
> > >
> > > I have had many design questions about this:
> >
> > I'm going to humbly express what I feel makes sense to me when looking
> > at this from a user perspective:
> >
> > > 1) Should we also report FAN_UNMOUNT for marked inodes and sb
> > >    on sb shutdown (same as IN_UNMOUNT)?
> >
> > My preference would be if this would be a separate event type.
> > FAN_SB_SHUTDOWN or something.
> 
> If we implement an event for this at all, I would suggest FAN_IGNORED
> or FAN_EVICTED, which has the same meaning as IN_IGNORED.
> When you get an event that the watch went away, it could be because of:
> 1. watch removed by user
> 2. watch removed because inode was evicted (with FAN_MARK_EVICTABLE)
> 3. inode deleted
> 4. sb shutdown
> 
> IN_IGNORED is generated in all of the above except for inode evict
> that is not possible with inotify.
> 
> User can figure out on his own if the inode was deleted or if fs was unmounted,
> so there is not really a need for FAN_SB_SHUTDOWN IMO.

Ok, sounds good.

> 
> Actually, I think that FAN_IGNORED would be quite useful for the
> FAN_MARK_EVICTABLE case, but it is a bit less trivial to implement
> than FAN_UNMOUNT was.
> 
> >
> > > 2) Should we also report FAN_UNMOUNT on sb mark for any unmounts
> > >    of that sb?
> >
> > I don't think so. It feels to me that if you watch an sb you don't
> > necessarily want to watch bind mounts of that sb.
> >
> > > 3) Should we report also the fid of the mount root? and if we do...
> > > 4) Should we report/consider FAN_ONDIR filter?
> > >
> > > All of the questions above I answered "not unless somebody requests"
> > > in this first RFC.
> >
> > Fwiw, I agree.
> >
> > >
> > > Specifically, I did get a request for an unmount event for containers
> > > use case.
> > >
> > > I have also had doubts regarding the info records.
> > > I decided that reporting fsid and mntid is minimum, but couldn't
> > > decide if they were better of in a single MNTID record or seprate
> > > records.
> > >
> > > I went with separate records, because:
> > > a) FAN_FS_ERROR has set a precendent of separate fid record with
> > >    fsid and empty fid, so I followed this precendent
> > > b) MNTID record we may want to add later with FAN_REPORT_MNTID
> > >    to all the path events, so better that it is independent
> >
> 
> Just thought of another reason:
>  c) FAN_UNMOUNT does not need to require FAN_REPORT_FID
>      so it does not depend on filesystem having a valid f_fsid nor
>      exports_ops. In case of "pseudo" fs, FAN_UNMOUNT can report
>      only MNTID record (I will amend the patch with this minor change).

I see some pseudo fses generate f_fsid, e.g., tmpfs in mm/shmem.c
At the risk of putting my foot in my mouth, what's stopping us from
making them all support f_fsid?

  reply	other threads:[~2023-04-18 14:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14 18:29 [RFC][PATCH 0/2] Monitoring unmounted fs with fanotify Amir Goldstein
2023-04-14 18:29 ` [RFC][PATCH 1/2] fanotify: add support for FAN_UNMOUNT event Amir Goldstein
2023-04-18 13:43   ` Christian Brauner
2023-04-19 13:14   ` Jan Kara
2023-04-19 18:32     ` Amir Goldstein
2023-04-14 18:29 ` [RFC][PATCH 2/2] fanotify: report mntid info record with FAN_UNMOUNT events Amir Goldstein
2023-04-17  8:38   ` Amir Goldstein
2023-04-19 13:30   ` Jan Kara
2023-04-18 13:33 ` [RFC][PATCH 0/2] Monitoring unmounted fs with fanotify Christian Brauner
2023-04-18 13:56   ` Amir Goldstein
2023-04-18 14:12     ` Christian Brauner [this message]
2023-04-18 15:20       ` Amir Goldstein
2023-04-19 17:19         ` Christian Brauner
2023-04-20  6:12           ` Amir Goldstein
2023-04-20  7:46             ` Christian Brauner
2023-04-20  8:15               ` Amir Goldstein

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=20230418-absegnen-sputen-11212a0615c7@brauner \
    --to=brauner@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=repnop@google.com \
    /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).