--- x/fs/open.c +++ y/fs/open.c @@ -907,6 +907,7 @@ static int do_dentry_open(struct file *f static const struct file_operations empty_fops = {}; struct inode *inode = f->f_path.dentry->d_inode; int error; + struct super_block *sb = inode->i_sb; path_get(&f->f_path); f->f_inode = inode; @@ -929,6 +930,7 @@ static int do_dentry_open(struct file *f f->f_mode |= FMODE_WRITER; } + down_read(&sb->s_umount); /* POSIX.1-2008/SUSv4 Section XSI 2.9.7 */ if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) f->f_mode |= FMODE_ATOMIC_POS; @@ -956,6 +958,7 @@ static int do_dentry_open(struct file *f if (error) goto cleanup_all; } + up_read(&sb->s_umount); f->f_mode |= FMODE_OPENED; if ((f->f_mode & FMODE_READ) && likely(f->f_op->read || f->f_op->read_iter))