diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 278620e063ab..b57568d66fc4 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -128,6 +128,25 @@ static inline int fsnotify_file(struct file *file, __u32 mask) FSNOTIFY_PRIO_CONTENT)) return 0; + /* + * Open calls notify early on, so lower file system must be notified + */ + if (mask & FS_OPEN) { + if (path->dentry->d_op && + path->dentry->d_op->d_canonical_path) { + struct path lower_path; + int ret; + + path->dentry->d_op->d_canonical_path(path, &lower_path); + ret = fsnotify_parent(lower_path.dentry, mask, + &lower_path, FSNOTIFY_EVENT_PATH); + path_put(&lower_path); + + if (ret) + return ret; + } + } + return fsnotify_parent(path->dentry, mask, path, FSNOTIFY_EVENT_PATH); }