Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
6e6b1bd1
Commit
6e6b1bd1
authored
Aug 13, 2009
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kill cached_lookup() and real_lookup()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
2dd6d1f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
87 deletions
+66
-87
fs/namei.c
fs/namei.c
+66
-87
No files found.
fs/namei.c
View file @
6e6b1bd1
...
...
@@ -411,26 +411,6 @@ do_revalidate(struct dentry *dentry, struct nameidata *nd)
return
dentry
;
}
/*
* Internal lookup() using the new generic dcache.
* SMP-safe
*/
static
struct
dentry
*
cached_lookup
(
struct
dentry
*
parent
,
struct
qstr
*
name
,
struct
nameidata
*
nd
)
{
struct
dentry
*
dentry
=
__d_lookup
(
parent
,
name
);
/* lockess __d_lookup may fail due to concurrent d_move()
* in some unrelated directory, so try with d_lookup
*/
if
(
!
dentry
)
dentry
=
d_lookup
(
parent
,
name
);
if
(
dentry
&&
dentry
->
d_op
&&
dentry
->
d_op
->
d_revalidate
)
dentry
=
do_revalidate
(
dentry
,
nd
);
return
dentry
;
}
/*
* Short-cut version of permission(), for calling by
* path_walk(), when dcache lock is held. Combines parts
...
...
@@ -463,70 +443,6 @@ ok:
return
security_inode_permission
(
inode
,
MAY_EXEC
);
}
/*
* This is called when everything else fails, and we actually have
* to go to the low-level filesystem to find out what we should do..
*
* We get the directory semaphore, and after getting that we also
* make sure that nobody added the entry to the dcache in the meantime..
* SMP-safe
*/
static
struct
dentry
*
real_lookup
(
struct
dentry
*
parent
,
struct
qstr
*
name
,
struct
nameidata
*
nd
)
{
struct
dentry
*
result
;
struct
inode
*
dir
=
parent
->
d_inode
;
mutex_lock
(
&
dir
->
i_mutex
);
/*
* First re-do the cached lookup just in case it was created
* while we waited for the directory semaphore..
*
* FIXME! This could use version numbering or similar to
* avoid unnecessary cache lookups.
*
* The "dcache_lock" is purely to protect the RCU list walker
* from concurrent renames at this point (we mustn't get false
* negatives from the RCU list walk here, unlike the optimistic
* fast walk).
*
* so doing d_lookup() (with seqlock), instead of lockfree __d_lookup
*/
result
=
d_lookup
(
parent
,
name
);
if
(
!
result
)
{
struct
dentry
*
dentry
;
/* Don't create child dentry for a dead directory. */
result
=
ERR_PTR
(
-
ENOENT
);
if
(
IS_DEADDIR
(
dir
))
goto
out_unlock
;
dentry
=
d_alloc
(
parent
,
name
);
result
=
ERR_PTR
(
-
ENOMEM
);
if
(
dentry
)
{
result
=
dir
->
i_op
->
lookup
(
dir
,
dentry
,
nd
);
if
(
result
)
dput
(
dentry
);
else
result
=
dentry
;
}
out_unlock:
mutex_unlock
(
&
dir
->
i_mutex
);
return
result
;
}
/*
* Uhhuh! Nasty case: the cache was re-populated while
* we waited on the semaphore. Need to revalidate.
*/
mutex_unlock
(
&
dir
->
i_mutex
);
if
(
result
->
d_op
&&
result
->
d_op
->
d_revalidate
)
{
result
=
do_revalidate
(
result
,
nd
);
if
(
!
result
)
result
=
ERR_PTR
(
-
ENOENT
);
}
return
result
;
}
static
__always_inline
void
set_root
(
struct
nameidata
*
nd
)
{
if
(
!
nd
->
root
.
mnt
)
{
...
...
@@ -767,7 +683,8 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
struct
path
*
path
)
{
struct
vfsmount
*
mnt
=
nd
->
path
.
mnt
;
struct
dentry
*
dentry
;
struct
dentry
*
dentry
,
*
parent
;
struct
inode
*
dir
;
/*
* See if the low-level filesystem might want
* to use its own hash..
...
...
@@ -790,7 +707,59 @@ done:
return
0
;
need_lookup:
dentry
=
real_lookup
(
nd
->
path
.
dentry
,
name
,
nd
);
parent
=
nd
->
path
.
dentry
;
dir
=
parent
->
d_inode
;
mutex_lock
(
&
dir
->
i_mutex
);
/*
* First re-do the cached lookup just in case it was created
* while we waited for the directory semaphore..
*
* FIXME! This could use version numbering or similar to
* avoid unnecessary cache lookups.
*
* The "dcache_lock" is purely to protect the RCU list walker
* from concurrent renames at this point (we mustn't get false
* negatives from the RCU list walk here, unlike the optimistic
* fast walk).
*
* so doing d_lookup() (with seqlock), instead of lockfree __d_lookup
*/
dentry
=
d_lookup
(
parent
,
name
);
if
(
!
dentry
)
{
struct
dentry
*
new
;
/* Don't create child dentry for a dead directory. */
dentry
=
ERR_PTR
(
-
ENOENT
);
if
(
IS_DEADDIR
(
dir
))
goto
out_unlock
;
new
=
d_alloc
(
parent
,
name
);
dentry
=
ERR_PTR
(
-
ENOMEM
);
if
(
new
)
{
dentry
=
dir
->
i_op
->
lookup
(
dir
,
new
,
nd
);
if
(
dentry
)
dput
(
new
);
else
dentry
=
new
;
}
out_unlock:
mutex_unlock
(
&
dir
->
i_mutex
);
if
(
IS_ERR
(
dentry
))
goto
fail
;
goto
done
;
}
/*
* Uhhuh! Nasty case: the cache was re-populated while
* we waited on the semaphore. Need to revalidate.
*/
mutex_unlock
(
&
dir
->
i_mutex
);
if
(
dentry
->
d_op
&&
dentry
->
d_op
->
d_revalidate
)
{
dentry
=
do_revalidate
(
dentry
,
nd
);
if
(
!
dentry
)
dentry
=
ERR_PTR
(
-
ENOENT
);
}
if
(
IS_ERR
(
dentry
))
goto
fail
;
goto
done
;
...
...
@@ -1144,7 +1113,17 @@ static struct dentry *__lookup_hash(struct qstr *name,
goto
out
;
}
dentry
=
cached_lookup
(
base
,
name
,
nd
);
dentry
=
__d_lookup
(
base
,
name
);
/* lockess __d_lookup may fail due to concurrent d_move()
* in some unrelated directory, so try with d_lookup
*/
if
(
!
dentry
)
dentry
=
d_lookup
(
base
,
name
);
if
(
dentry
&&
dentry
->
d_op
&&
dentry
->
d_op
->
d_revalidate
)
dentry
=
do_revalidate
(
dentry
,
nd
);
if
(
!
dentry
)
{
struct
dentry
*
new
;
...
...
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