--- x/fs/open.c +++ y/fs/open.c @@ -952,7 +952,13 @@ static int do_dentry_open(struct file *f if (!open) open = f->f_op->open; if (open) { + struct super_block *sb = inode->i_sb; + + error = -ENODEV; + if (!super_trylock_shared(sb)) + goto cleanup_all; error = open(inode, f); + up_read(&sb->s_umount); if (error) goto cleanup_all; } --- x/fs/super.c +++ y/fs/super.c @@ -503,6 +503,7 @@ void deactivate_super(struct super_block { if (!atomic_add_unless(&s->s_active, -1, 1)) { __super_lock_excl(s); + s->s_flags |= SB_DYING; deactivate_locked_super(s); } }