Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
643822b4
Commit
643822b4
authored
Nov 24, 2011
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vfs: spread struct mount - is_path_reachable
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
676da58d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
fs/namespace.c
fs/namespace.c
+7
-7
fs/pnode.c
fs/pnode.c
+5
-5
fs/pnode.h
fs/pnode.h
+1
-1
No files found.
fs/namespace.c
View file @
643822b4
...
...
@@ -2559,21 +2559,21 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
*
* namespace_sem or vfsmount_lock is held
*/
bool
is_path_reachable
(
struct
vfs
mount
*
mnt
,
struct
dentry
*
dentry
,
bool
is_path_reachable
(
struct
mount
*
mnt
,
struct
dentry
*
dentry
,
const
struct
path
*
root
)
{
while
(
mnt
!=
root
->
mnt
&&
mnt_has_parent
(
real_mount
(
mnt
)
))
{
dentry
=
mnt
->
mnt_mountpoint
;
mnt
=
mnt
->
mnt_parent
;
while
(
&
mnt
->
mnt
!=
root
->
mnt
&&
mnt_has_parent
(
mnt
))
{
dentry
=
mnt
->
mnt
.
mnt
_mountpoint
;
mnt
=
real_mount
(
mnt
->
mnt
.
mnt_parent
)
;
}
return
mnt
==
root
->
mnt
&&
is_subdir
(
dentry
,
root
->
dentry
);
return
&
mnt
->
mnt
==
root
->
mnt
&&
is_subdir
(
dentry
,
root
->
dentry
);
}
int
path_is_under
(
struct
path
*
path1
,
struct
path
*
path2
)
{
int
res
;
br_read_lock
(
vfsmount_lock
);
res
=
is_path_reachable
(
path1
->
mnt
,
path1
->
dentry
,
path2
);
res
=
is_path_reachable
(
real_mount
(
path1
->
mnt
)
,
path1
->
dentry
,
path2
);
br_read_unlock
(
vfsmount_lock
);
return
res
;
}
...
...
@@ -2659,7 +2659,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
if
(
!
mnt_has_parent
(
new_mnt
))
goto
out4
;
/* not attached */
/* make sure we can reach put_old from new_root */
if
(
!
is_path_reachable
(
old
.
mnt
,
old
.
dentry
,
&
new
))
if
(
!
is_path_reachable
(
real_mount
(
old
.
mnt
)
,
old
.
dentry
,
&
new
))
goto
out4
;
br_write_lock
(
vfsmount_lock
);
detach_mnt
(
new_mnt
,
&
parent_path
);
...
...
fs/pnode.c
View file @
643822b4
...
...
@@ -32,15 +32,15 @@ static struct vfsmount *get_peer_under_root(struct vfsmount *mnt,
struct
mnt_namespace
*
ns
,
const
struct
path
*
root
)
{
struct
vfsmount
*
m
=
mnt
;
struct
mount
*
m
=
real_mount
(
mnt
)
;
do
{
/* Check the namespace first for optimization */
if
(
m
->
mnt
_ns
==
ns
&&
is_path_reachable
(
m
,
m
->
mnt_root
,
root
))
return
m
;
if
(
m
->
mnt
.
mnt_ns
==
ns
&&
is_path_reachable
(
m
,
m
->
mnt
.
mnt_root
,
root
))
return
&
m
->
mnt
;
m
=
next_peer
(
m
);
}
while
(
m
!=
mnt
);
m
=
real_mount
(
next_peer
(
&
m
->
mnt
)
);
}
while
(
&
m
->
mnt
!=
mnt
);
return
NULL
;
}
...
...
fs/pnode.h
View file @
643822b4
...
...
@@ -42,6 +42,6 @@ void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
void
release_mounts
(
struct
list_head
*
);
void
umount_tree
(
struct
mount
*
,
int
,
struct
list_head
*
);
struct
mount
*
copy_tree
(
struct
mount
*
,
struct
dentry
*
,
int
);
bool
is_path_reachable
(
struct
vfs
mount
*
,
struct
dentry
*
,
bool
is_path_reachable
(
struct
mount
*
,
struct
dentry
*
,
const
struct
path
*
root
);
#endif
/* _LINUX_PNODE_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment