--- x/fs/open.c +++ y/fs/open.c @@ -35,6 +35,8 @@ #include #include "internal.h" +#include "mount.h" +#include "pnode.h" int do_truncate(struct mnt_idmap *idmap, struct dentry *dentry, loff_t length, unsigned int time_attrs, struct file *filp) @@ -952,6 +954,12 @@ static int do_dentry_open(struct file *f if (!open) open = f->f_op->open; if (open) { + struct mount *mnt = real_mount(f->f_path.mnt); + error = -ENODEV; + if (mnt->mnt.mnt_flags & MNT_DOOMED) + goto cleanup_all; + if (mnt_get_count(mnt) < 2) + goto cleanup_all; error = open(inode, f); if (error) goto cleanup_all;