]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit - include/linux/fsnotify.h
fsnotify: report FS_ISDIR flag with MOVE_SELF and DELETE_SELF events
authorAmir Goldstein <amir73il@gmail.com>
Thu, 10 Jan 2019 17:04:40 +0000 (19:04 +0200)
committerJan Kara <jack@suse.cz>
Thu, 7 Feb 2019 15:38:35 +0000 (16:38 +0100)
commit0a20df7ed3349dfa3260ddee2efa919df44d0ad5
treea67f25db1275679997c0d7348c0c25896e33dde7
parent73072283a249c798838e09813760db8bcdd9cd3a
fsnotify: report FS_ISDIR flag with MOVE_SELF and DELETE_SELF events

We need to report FS_ISDIR flag with MOVE_SELF and DELETE_SELF events
for fanotify, because fanotify API requires the user to explicitly
request events on directories by FAN_ONDIR flag.

inotify never reported IN_ISDIR with those events. It looks like an
oversight, but to avoid the risk of breaking existing inotify programs,
mask the FS_ISDIR flag out when reprting those events to inotify backend.

We also add the FS_ISDIR flag with FS_ATTRIB event in the case of rename
over an empty target directory. inotify did not report IN_ISDIR in this
case, but it normally does report IN_ISDIR along with IN_ATTRIB event,
so in this case, we do not mask out the FS_ISDIR flag.

[JK: Simplify the checks in fsnotify_move()]

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/notify/inotify/inotify_fsnotify.c
include/linux/fsnotify.h