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
Kirill Smelkov
linux
Commits
8bac9db9
Commit
8bac9db9
authored
Apr 16, 2010
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFSv4: Reduce stack footprint of nfs4_get_root()
Signed-off-by:
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
parent
04ffdbe2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
30 deletions
+46
-30
fs/nfs/getroot.c
fs/nfs/getroot.c
+46
-30
No files found.
fs/nfs/getroot.c
View file @
8bac9db9
...
...
@@ -78,46 +78,52 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
{
struct
nfs_server
*
server
=
NFS_SB
(
sb
);
struct
nfs_fsinfo
fsinfo
;
struct
nfs_fattr
fattr
;
struct
dentry
*
mntroot
;
struct
dentry
*
ret
;
struct
inode
*
inode
;
int
error
;
/* get the actual root for this mount */
fsinfo
.
fattr
=
&
fattr
;
fsinfo
.
fattr
=
nfs_alloc_fattr
();
if
(
fsinfo
.
fattr
==
NULL
)
return
ERR_PTR
(
-
ENOMEM
);
error
=
server
->
nfs_client
->
rpc_ops
->
getroot
(
server
,
mntfh
,
&
fsinfo
);
if
(
error
<
0
)
{
dprintk
(
"nfs_get_root: getattr error = %d
\n
"
,
-
error
);
return
ERR_PTR
(
error
);
ret
=
ERR_PTR
(
error
);
goto
out
;
}
inode
=
nfs_fhget
(
sb
,
mntfh
,
fsinfo
.
fattr
);
if
(
IS_ERR
(
inode
))
{
dprintk
(
"nfs_get_root: get root inode failed
\n
"
);
return
ERR_CAST
(
inode
);
ret
=
ERR_CAST
(
inode
);
goto
out
;
}
error
=
nfs_superblock_set_dummy_root
(
sb
,
inode
);
if
(
error
!=
0
)
return
ERR_PTR
(
error
);
if
(
error
!=
0
)
{
ret
=
ERR_PTR
(
error
);
goto
out
;
}
/* root dentries normally start off anonymous and get spliced in later
* if the dentry tree reaches them; however if the dentry already
* exists, we'll pick it up at this point and use it as the root
*/
mntroo
t
=
d_obtain_alias
(
inode
);
if
(
IS_ERR
(
mntroo
t
))
{
re
t
=
d_obtain_alias
(
inode
);
if
(
IS_ERR
(
re
t
))
{
dprintk
(
"nfs_get_root: get root dentry failed
\n
"
);
return
mntroo
t
;
goto
ou
t
;
}
security_d_instantiate
(
mntroo
t
,
inode
);
security_d_instantiate
(
re
t
,
inode
);
if
(
!
mntroot
->
d_op
)
mntroot
->
d_op
=
server
->
nfs_client
->
rpc_ops
->
dentry_ops
;
return
mntroot
;
if
(
ret
->
d_op
==
NULL
)
ret
->
d_op
=
server
->
nfs_client
->
rpc_ops
->
dentry_ops
;
out:
nfs_free_fattr
(
fsinfo
.
fattr
);
return
ret
;
}
#ifdef CONFIG_NFS_V4
...
...
@@ -168,8 +174,8 @@ int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh)
struct
dentry
*
nfs4_get_root
(
struct
super_block
*
sb
,
struct
nfs_fh
*
mntfh
)
{
struct
nfs_server
*
server
=
NFS_SB
(
sb
);
struct
nfs_fattr
fattr
;
struct
dentry
*
mntroo
t
;
struct
nfs_fattr
*
fattr
=
NULL
;
struct
dentry
*
re
t
;
struct
inode
*
inode
;
int
error
;
...
...
@@ -183,40 +189,50 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
return
ERR_PTR
(
error
);
}
fattr
=
nfs_alloc_fattr
();
if
(
fattr
==
NULL
)
return
ERR_PTR
(
-
ENOMEM
);;
/* get the actual root for this mount */
error
=
server
->
nfs_client
->
rpc_ops
->
getattr
(
server
,
mntfh
,
&
fattr
);
error
=
server
->
nfs_client
->
rpc_ops
->
getattr
(
server
,
mntfh
,
fattr
);
if
(
error
<
0
)
{
dprintk
(
"nfs_get_root: getattr error = %d
\n
"
,
-
error
);
return
ERR_PTR
(
error
);
ret
=
ERR_PTR
(
error
);
goto
out
;
}
inode
=
nfs_fhget
(
sb
,
mntfh
,
&
fattr
);
inode
=
nfs_fhget
(
sb
,
mntfh
,
fattr
);
if
(
IS_ERR
(
inode
))
{
dprintk
(
"nfs_get_root: get root inode failed
\n
"
);
return
ERR_CAST
(
inode
);
ret
=
ERR_CAST
(
inode
);
goto
out
;
}
error
=
nfs_superblock_set_dummy_root
(
sb
,
inode
);
if
(
error
!=
0
)
return
ERR_PTR
(
error
);
if
(
error
!=
0
)
{
ret
=
ERR_PTR
(
error
);
goto
out
;
}
/* root dentries normally start off anonymous and get spliced in later
* if the dentry tree reaches them; however if the dentry already
* exists, we'll pick it up at this point and use it as the root
*/
mntroo
t
=
d_obtain_alias
(
inode
);
if
(
IS_ERR
(
mntroo
t
))
{
re
t
=
d_obtain_alias
(
inode
);
if
(
IS_ERR
(
re
t
))
{
dprintk
(
"nfs_get_root: get root dentry failed
\n
"
);
return
mntroo
t
;
goto
ou
t
;
}
security_d_instantiate
(
mntroo
t
,
inode
);
security_d_instantiate
(
re
t
,
inode
);
if
(
!
mntroot
->
d_op
)
mntroo
t
->
d_op
=
server
->
nfs_client
->
rpc_ops
->
dentry_ops
;
if
(
ret
->
d_op
==
NULL
)
re
t
->
d_op
=
server
->
nfs_client
->
rpc_ops
->
dentry_ops
;
out:
nfs_free_fattr
(
fattr
);
dprintk
(
"<-- nfs4_get_root()
\n
"
);
return
mntroo
t
;
return
re
t
;
}
#endif
/* CONFIG_NFS_V4 */
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