#include <linux/prefetch.h>
#include <linux/ratelimit.h>
#include "internal.h"
+#include "mount.h"
/*
* Usage:
if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
/* Global root? */
- if (vfsmnt->mnt_parent == vfsmnt) {
+ if (!mnt_has_parent(vfsmnt))
goto global_root;
- }
dentry = vfsmnt->mnt_mountpoint;
vfsmnt = vfsmnt->mnt_parent;
continue;
br_read_lock(vfsmount_lock);
if (mnt != path2->mnt) {
for (;;) {
- if (mnt->mnt_parent == mnt) {
+ if (!mnt_has_parent(mnt)) {
br_read_unlock(vfsmount_lock);
return 0;
}
while (!list_empty(head)) {
mnt = list_first_entry(head, struct vfsmount, mnt_hash);
list_del_init(&mnt->mnt_hash);
- if (mnt->mnt_parent != mnt) {
+ if (mnt_has_parent(mnt)) {
struct dentry *dentry;
struct vfsmount *m;
p->mnt_ns = NULL;
__mnt_make_shortterm(p);
list_del_init(&p->mnt_child);
- if (p->mnt_parent != p) {
+ if (mnt_has_parent(p)) {
p->mnt_parent->mnt_ghosts++;
dentry_reset_mounted(p->mnt_parent, p->mnt_mountpoint);
}
if (old_path.dentry != old_path.mnt->mnt_root)
goto out1;
- if (old_path.mnt == old_path.mnt->mnt_parent)
+ if (!mnt_has_parent(old_path.mnt))
goto out1;
if (S_ISDIR(path->dentry->d_inode->i_mode) !=
tree_contains_unbindable(old_path.mnt))
goto out1;
err = -ELOOP;
- for (p = path->mnt; p->mnt_parent != p; p = p->mnt_parent)
+ for (p = path->mnt; mnt_has_parent(p); p = p->mnt_parent)
if (p == old_path.mnt)
goto out1;
error = -EINVAL;
if (root.mnt->mnt_root != root.dentry)
goto out4; /* not a mountpoint */
- if (root.mnt->mnt_parent == root.mnt)
+ if (!mnt_has_parent(root.mnt))
goto out4; /* not attached */
if (new.mnt->mnt_root != new.dentry)
goto out4; /* not a mountpoint */
- if (new.mnt->mnt_parent == new.mnt)
+ if (!mnt_has_parent(new.mnt))
goto out4; /* not attached */
/* make sure we can reach put_old from new_root */
tmp = old.mnt;
if (tmp != new.mnt) {
for (;;) {
- if (tmp->mnt_parent == tmp)
+ if (!mnt_has_parent(tmp))
goto out4; /* already mounted on put_old */
if (tmp->mnt_parent == new.mnt)
break;