diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 4da80e92f804..66512a965824 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -453,6 +453,10 @@ static inline int fsnotify_sb_error(struct super_block *sb, struct inode *inode, .sb = sb, }; + /* fs may be calling this hook from without shutdown */ + if (unlikely(!(sb->s_flags & SB_ACTIVE))) + return 0; + return fsnotify(FS_ERROR, &report, FSNOTIFY_EVENT_ERROR, NULL, NULL, NULL, 0); }