diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 4da80e92f804f..73cb11ea4534b 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -23,6 +23,9 @@ static inline bool fsnotify_sb_has_priority_watchers(struct super_block *sb, { struct fsnotify_sb_info *sbinfo = fsnotify_sb_info(sb); + if (unlikely(!(sb->s_flags & SB_ACTIVE))) + return 0; + /* Were any marks ever added to any object on this sb? */ if (!sbinfo) return false; @@ -453,6 +456,9 @@ static inline int fsnotify_sb_error(struct super_block *sb, struct inode *inode, .sb = sb, }; + if (!fsnotify_sb_has_watchers(sb)) + return 0; + return fsnotify(FS_ERROR, &report, FSNOTIFY_EVENT_ERROR, NULL, NULL, NULL, 0); }