All of lore.kernel.org
 help / color / mirror / Atom feed
* Fanotify API - Tracking File Movement
@ 2022-05-05 10:25 Matthew Bobrowski
  2022-05-05 11:22 ` Jan Kara
  0 siblings, 1 reply; 14+ messages in thread
From: Matthew Bobrowski @ 2022-05-05 10:25 UTC (permalink / raw)
  To: jack, amir73il; +Cc: linux-api

Hey Jan,

I was having a brief chat with Amir the other day about an idea/use
case that I have which at present don't believe is robustly supported
by the fanotify API. I was wondering whether you could share some
thoughts on supporting the following idea.

I have a need to track file movement across a filesystem without
necessarily burdening the system by having to watch the entire
filesystem for such movements. That is, knowing when file /dir1/a had
been moved from /dir1/a to /dir2/a and then from /dir2/a to /dir3/a
and so on. Or more simply, knowing the destination/new path of the
file once it has moved.

Initially, I was thinking of using FAN_MOVE_SELF, but it doesn't quite
cut it. For such events, you only know the target location or path of
a file had been modified once it has subsequently been moved
elsewhere. Not to mention that path resolution using the file
identifier from such an event may not always work. Then there's
FAN_RENAME which could arguably work. This would include setting up a
watch on the parent directory of the file of interest and then using
the information record of type FAN_EVENT_INFO_TYPE_NEW_DFID_NAME to
figure out the new target location of the file once it has been moved
and then resetting the mark on the next parent directory once the new
target location is known. But, as Amir rightfully mentioned, this
rinse and repeat mark approach is suboptimal as it can lead to certain
race conditions.

Having briefly mentioned all this, what is your stance on maybe
extending out FAN_RENAME to also cover files? Or, maybe you have
another approach/idea in mind to cover such cases i.e. introducing a
new flag FAN_{TRACK,TRACE}.

Eager to hear your thoughts on this.

/M

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-05-13 18:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-05-13 14:14                 ` Amir Goldstein
2022-05-13 15:54                   ` Matthew Bobrowski
2022-05-13 18:39                     ` Amir Goldstein

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.