forked from tytso/ext4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fanotify: introduce directory entry pre-modify permission events
Add fsnotify_{name,rename}_perm() hooks to generate FAN_PRE_{CREATE,DELETE,MOVE_*} permission events when filesystem objects are about to be linked/unlinked to/from the directory specified by path. The directory entry pre-modify permission events will not be generated when the operation is performed relative to a O_PATH dfd that was received inside a lookup permission event. Pre-modify permission events are called without filesystem locks held, so backends will be able to perform filesystem operations before the modification. The intended consumer is a persistent change tracking service. We add the wrappers mnt_want_write_parent{,s}(), which pass the paths and directory entry names of the filesystem objects about to be modified and call the fsnotify pre-modify permission hooks. The new wrappers also acquire/release s_write_srcu to opt-in to vfs write barriers. The srcu read section covers both the pre-modify event and the directory entry modification that follows. These hooks do not cover all the possible ways that users can make directory entry modifications, but they cover the relevant syscalls. Modifications via overlayfs to upper layer do not generate pre-modify events which is consistent with the fact that overlayfs sets the FMODE_NONOTIFY flag on underlying open files. Modifications via nfsd will be covered by a followup patch. Signed-off-by: Amir Goldstein <amir73il@gmail.com>
- Loading branch information
Showing
8 changed files
with
200 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.