From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Matthew Bobrowski <mbobrowski@mbobrowski.org>,
linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org
Subject: [PATCH 0/7] Report more information in fanotify dirent events
Date: Fri, 29 Oct 2021 14:40:21 +0300 [thread overview]
Message-ID: <20211029114028.569755-1-amir73il@gmail.com> (raw)
Jan,
This patch set follows up on the discussion on FAN_REPORT_TARGET_FID [1]
from 3 months ago.
With FAN_REPORT_PIDFD in 5.15 and FAN_FS_ERROR on its way to 5.16,
I figured we could get an early (re)start of the discussion on
FAN_REPORT_TARGET_FID towards 5.17.
The added information in dirent events solves problems for my use case -
It helps getting the following information in a race free manner:
1. fid of a created directory on mkdir
2. from/to path information on rename of non-dir
I realize those are two different API traits, but they are close enough
so I preferred not to clutter the REPORT flags space any further than it
already is. The single added flag FAN_REPORT_TARGET_FID adds:
1. child fid info to CREATE/DELETE/MOVED_* events
2. new parent+name info to MOVED_FROM event
Instead of going the "inotify way" and trying to join the MOVED_FROM/
MOVED_TO events using a cookie, I chose to incorporate the new
parent+name intomation only in the MOVED_FROM event.
I made this choice for several reasons:
1. Availability of the moved dentry in the hook and event data
2. First info record is the old parent+name, like FAN_REPORT_DFID_NAME
3. Unlike, MOVED_TO, MOVED_FROM was useless for applications that use
DFID_NAME info to statat(2) the object as we suggested
I chose to reduce testing complexity and require all other FID
flags with FAN_REPORT_TARGET_FID and there is a convenience
macro FAN_REPORT_ALL_FIDS that application can use.
This restriction could be relaxed in the future if we have a good reason
to do so.
Since the POC branch 3 months ago, I dropped the 'sub_type' field of
the info header, because it did not add much value IMO.
Patches [2] and LTP test [3] are available on my github.
Thanks,
Amir.
[1] https://lore.kernel.org/linux-fsdevel/CAOQ4uxjYDDk00VPdWtRB1_tf+gCoPFgSQ9O0p0fGaW_JiFUUKA@mail.gmail.com/
[2] https://github.com/amir73il/linux/commits/fanotify_target_fid
[3] https://github.com/amir73il/ltp/commits/fanotify_target_fid
Amir Goldstein (7):
fsnotify: pass dentry instead of inode data for move events
fanotify: introduce group flag FAN_REPORT_TARGET_FID
fanotify: use macros to get the offset to fanotify_info buffer
fanotify: support secondary dir fh and name in fanotify_info
fanotify: record new parent and name in MOVED_FROM event
fanotify: report new parent and name in MOVED_FROM event
fanotify: enable the FAN_REPORT_TARGET_FID flag
fs/notify/fanotify/fanotify.c | 108 ++++++++++++++++++++++-----
fs/notify/fanotify/fanotify.h | 113 +++++++++++++++++++++++++----
fs/notify/fanotify/fanotify_user.c | 43 +++++++++--
include/linux/fanotify.h | 2 +-
include/linux/fsnotify.h | 7 +-
include/uapi/linux/fanotify.h | 5 ++
6 files changed, 235 insertions(+), 43 deletions(-)
--
2.33.1
next reply other threads:[~2021-10-29 11:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 11:40 Amir Goldstein [this message]
2021-10-29 11:40 ` [PATCH 1/7] fsnotify: pass dentry instead of inode data for move events Amir Goldstein
2021-10-29 11:40 ` [PATCH 2/7] fanotify: introduce group flag FAN_REPORT_TARGET_FID Amir Goldstein
2021-10-29 11:40 ` [PATCH 3/7] fanotify: use macros to get the offset to fanotify_info buffer Amir Goldstein
2021-10-29 11:40 ` [PATCH 4/7] fanotify: support secondary dir fh and name in fanotify_info Amir Goldstein
2021-10-29 11:40 ` [PATCH 5/7] fanotify: record new parent and name in MOVED_FROM event Amir Goldstein
2021-11-12 16:48 ` Jan Kara
2021-11-13 9:40 ` Amir Goldstein
2021-11-15 8:18 ` Jan Kara
2021-10-29 11:40 ` [PATCH 6/7] fanotify: report " Amir Goldstein
2021-10-29 11:40 ` [PATCH 7/7] fanotify: enable the FAN_REPORT_TARGET_FID flag Amir Goldstein
2021-11-06 16:29 ` [PATCH 0/7] Report more information in fanotify dirent events Amir Goldstein
2021-11-12 16:39 ` Jan Kara
2021-11-13 9:49 ` Amir Goldstein
2021-11-13 19:31 ` Amir Goldstein
2021-11-15 10:23 ` Jan Kara
2021-11-15 12:22 ` Amir Goldstein
2021-11-15 14:37 ` Jan Kara
2021-11-16 6:59 ` Amir Goldstein
2021-11-16 10:12 ` Jan Kara
2021-11-18 12:47 ` Amir Goldstein
2021-11-18 16:29 ` Jan Kara
2021-11-18 16:43 ` 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=20211029114028.569755-1-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mbobrowski@mbobrowski.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 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).