1193
1194 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(mnt))
1195 return NULL;
1196
1197 res = q = clone_mnt(mnt, dentry, flag);
1198 if (!q)
1199 goto Enomem;
1200 q->mnt_mountpoint = mnt->mnt_mountpoint;
1201
1202 p = mnt;
1203 list_for_each_entry(r, &mnt->mnt_mounts, mnt_child) {
1204 if (!is_subdir(r->mnt_mountpoint, dentry))
1205 continue;
1206
1207 for (s = r; s; s = next_mnt(s, r)) {
1208 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(s)) {
1209 s = skip_mnt_tree(s);
1210 continue;
1211 }
1212 while (p != s->mnt_parent) {
1213 p = p->mnt_parent;
1214 q = q->mnt_parent;
1215 }
1216 p = s;
1217 path.mnt = q;
1218 path.dentry = p->mnt_mountpoint;
1219 q = clone_mnt(p, p->mnt_root, flag);
1220 if (!q)
1221 goto Enomem;
1222 spin_lock(&vfsmount_lock);
1223 list_add_tail(&q->mnt_list, &res->mnt_list);
1224 attach_mnt(q, &path);
1225 spin_unlock(&vfsmount_lock);
1226 }
1227 }
1228 return res;
1229Enomem:
1230 if (res) {
1231 LIST_HEAD(umount_list);
1232 spin_lock(&vfsmount_lock);
1233 umount_tree(res, 0, &umount_list);