--- x/fs/open.c +++ y/fs/open.c @@ -952,7 +952,18 @@ 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 = -EINVAL; + for (;;) { + int a = atomic_read(&sb->s_active); + if (a < 1) + goto cleanup_all; + if (a == atomic_cmpxchg(&sb->s_active, a, a+1)) + break; + } error = open(inode, f); + deactivate_super(sb); if (error) goto cleanup_all; }