History

fanotify: report FAN_ONDIR to listener with FAN_REPORT_FID

dirent modification events (create/delete/move) do not carry the child entry name/inode information. Instead, we report FAN_ONDIR for mkdir/rmdir so user can differentiate them from creat/unlink. This is consistent with inotify reporting IN_ISDIR with dirent events and is useful for implementing recursive directory tree watcher. We avoid merging dirent events referring to subdirs with dirent events referring to non subdirs, otherwise, user won't be able to tell from a mask FAN_CREATE|FAN_DELETE|FAN_ONDIR if it describes mkdir+unlink pair or rmdir+create pair of events. For backward compatibility and consistency, do not report FAN_ONDIR to user in legacy fanotify mode (reporting fd) and report FAN_ONDIR to user in FAN_REPORT_FID mode for all event types.

Amir Goldstein committed 7 years ago

Commit e7fce6d1 parent 235328d2 files · +32 −4Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/fanotify.h+1−1
@@ -67,7 +67,7 @@ · 66 unmodified lines
6767 /* Events that may be reported to user */
6868 #define FANOTIFY_OUTGOING_EVENTS (FANOTIFY_EVENTS | \
6969 FANOTIFY_PERM_EVENTS | \
70− FAN_Q_OVERFLOW)
70+ FAN_Q_OVERFLOW | FAN_ONDIR)
7171
7272 #define ALL_FANOTIFY_EVENT_BITS (FANOTIFY_OUTGOING_EVENTS | \
7373 FANOTIFY_EVENT_FLAGS)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t