All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Bobrowski <repnop@google.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Linux API <linux-api@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: Fanotify API - Tracking File Movement
Date: Fri, 13 May 2022 13:18:15 +0000	[thread overview]
Message-ID: <Yn5al/rEQIcf6pjR@google.com> (raw)
In-Reply-To: <CAOQ4uxjEcbjRoObAUfSS3RHVJY7EiW8tJSo1geNtbgQbcTOM+A@mail.gmail.com>

On Sat, May 07, 2022 at 07:03:13PM +0300, Amir Goldstein wrote:
> Sorry Matthew, I was looking at the code to give you pointers, but there were
> so many subtle details (as Jan has expected) that I could only communicate
> them with a patch.
> I tested that this patch does not break anything, but did not implement the
> UAPI changes, so the functionality that it adds is not tested - I leave that
> to you.

No, that's totally fine. I had to familiarize myself with the
FS/FAN_RENAME implementation as I hadn't gone over that series. So
appreciate you whipping this together quickly as it would've taken a
fair bit of time.

Before the UAPI related modifications, we need to first figure out how
we are to handle the CREATE/DELETE/MOVE cases.

...

> My 0.02$ - while FAN_RENAME is a snowflake, this is not because
> of our design, this is because rename(2) is a snowflake vfs operation.
> The event information simply reflects the operation complexity and when
> looking at non-Linux filesystem event APIs, the event information for rename
> looks very similar to FAN_RENAME. In some cases (lustre IIRC) the protocol
> was enhanced at some point exactly as we did with FAN_RENAME to
> have all the info in one event vs. having to join two events.
> 
> Hopefully, the attached patch simplifies the specialized implementation
> a little bit.
> 
> But... (there is always a but when it comes to UAPI),
> When looking at my patch, one cannot help wondering -
> what about FAN_CREATE/FAN_DELETE/FAN_MOVE?
> If those can report child fid, why should they be treated differently
> than FAN_RENAME w.r.t marking the child inode?

This is something that crossed my mind while looking over the patch
and is a very good thing to call-out indeed. I am of the opinion that
we shouldn't be placing FAN_RENAME in the special egg basket and also
consider how this is to operate for events
FAN_CREATE/FAN_DELETE/FAN_MOVE.

> For example, when watching a non-dir for FAN_CREATE, it could
> be VERY helpful to get the dirfid+name of where the inode was
> hard linked.

Oh right, here you're referring to this specific scenario:

- FAN_CREATE mark exclusively placed on /dir1/old_file
- Create link(/dir1/old_file, /dir2/new_file)
- Expect to receive single event including two information records
  FID(/dir1/old_file) + DFID_NAME(/dir2/new_file)

Is that correct?

> In fact, if an application is watching FAN_RENAME to track the
> movement of a non-dir file and does not watch hardlink+unlink, then
> the file could escape under the application's nose.

That's understood.

/M


  parent reply	other threads:[~2022-05-13 13:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 10:25 Fanotify API - Tracking File Movement Matthew Bobrowski
2022-05-05 11:22 ` Jan Kara
2022-05-05 12:56   ` Amir Goldstein
2022-05-05 13:30     ` Jan Kara
2022-05-05 23:44       ` Matthew Bobrowski
2022-05-06  0:00         ` Amir Goldstein
2022-05-06 10:06           ` Jan Kara
2022-05-07 16:03             ` Amir Goldstein
2022-05-11 17:52               ` Jan Kara
2022-05-11 18:54                 ` Amir Goldstein
2022-05-13 13:18               ` Matthew Bobrowski [this message]
2022-05-13 14:14                 ` Amir Goldstein
2022-05-13 15:54                   ` Matthew Bobrowski
2022-05-13 18:39                     ` 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=Yn5al/rEQIcf6pjR@google.com \
    --to=repnop@google.com \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.