Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
f134585a
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f134585a
编写于
9月 23, 2005
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "[PATCH] RPC,NFS: new rpc_pipefs patch"
This reverts 17f4e6febca160a9f9dd4bdece9784577a2f4524 commit.
上级
3063d8a1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
209 addition
and
142 deletion
+209
-142
fs/nfs/idmap.c
fs/nfs/idmap.c
+7
-3
include/linux/sunrpc/clnt.h
include/linux/sunrpc/clnt.h
+1
-1
include/linux/sunrpc/rpc_pipe_fs.h
include/linux/sunrpc/rpc_pipe_fs.h
+4
-5
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/auth_gss.c
+6
-3
net/sunrpc/clnt.c
net/sunrpc/clnt.c
+17
-36
net/sunrpc/rpc_pipe.c
net/sunrpc/rpc_pipe.c
+174
-94
未找到文件。
fs/nfs/idmap.c
浏览文件 @
f134585a
...
...
@@ -66,6 +66,7 @@ struct idmap_hashtable {
};
struct
idmap
{
char
idmap_path
[
48
];
struct
dentry
*
idmap_dentry
;
wait_queue_head_t
idmap_wq
;
struct
idmap_msg
idmap_im
;
...
...
@@ -101,8 +102,11 @@ nfs_idmap_new(struct nfs4_client *clp)
memset
(
idmap
,
0
,
sizeof
(
*
idmap
));
idmap
->
idmap_dentry
=
rpc_mkpipe
(
clp
->
cl_rpcclient
->
cl_dentry
,
"idmap"
,
idmap
,
&
idmap_upcall_ops
,
0
);
snprintf
(
idmap
->
idmap_path
,
sizeof
(
idmap
->
idmap_path
),
"%s/idmap"
,
clp
->
cl_rpcclient
->
cl_pathname
);
idmap
->
idmap_dentry
=
rpc_mkpipe
(
idmap
->
idmap_path
,
idmap
,
&
idmap_upcall_ops
,
0
);
if
(
IS_ERR
(
idmap
->
idmap_dentry
))
{
kfree
(
idmap
);
return
;
...
...
@@ -124,7 +128,7 @@ nfs_idmap_delete(struct nfs4_client *clp)
if
(
!
idmap
)
return
;
rpc_unlink
(
idmap
->
idmap_
dentry
);
rpc_unlink
(
idmap
->
idmap_
path
);
clp
->
cl_idmap
=
NULL
;
kfree
(
idmap
);
}
...
...
include/linux/sunrpc/clnt.h
浏览文件 @
f134585a
...
...
@@ -59,7 +59,7 @@ struct rpc_clnt {
int
cl_nodelen
;
/* nodename length */
char
cl_nodename
[
UNX_MAXNODENAME
];
struct
dentry
*
__cl_parent_dentry
;
char
cl_pathname
[
30
];
/* Path in rpc_pipe_fs */
struct
dentry
*
cl_dentry
;
/* inode */
struct
rpc_clnt
*
cl_parent
;
/* Points to parent of clones */
struct
rpc_rtt
cl_rtt_default
;
...
...
include/linux/sunrpc/rpc_pipe_fs.h
浏览文件 @
f134585a
...
...
@@ -41,11 +41,10 @@ RPC_I(struct inode *inode)
extern
int
rpc_queue_upcall
(
struct
inode
*
,
struct
rpc_pipe_msg
*
);
extern
struct
dentry
*
rpc_mkdir
(
struct
dentry
*
,
char
*
,
struct
rpc_clnt
*
);
extern
void
rpc_rmdir
(
struct
dentry
*
);
extern
struct
dentry
*
rpc_mkpipe
(
struct
dentry
*
,
char
*
,
void
*
,
struct
rpc_pipe_ops
*
,
int
flags
);
extern
void
rpc_unlink
(
struct
dentry
*
);
extern
struct
dentry
*
rpc_mkdir
(
char
*
,
struct
rpc_clnt
*
);
extern
int
rpc_rmdir
(
char
*
);
extern
struct
dentry
*
rpc_mkpipe
(
char
*
,
void
*
,
struct
rpc_pipe_ops
*
,
int
flags
);
extern
int
rpc_unlink
(
char
*
);
#endif
#endif
net/sunrpc/auth_gss/auth_gss.c
浏览文件 @
f134585a
...
...
@@ -87,6 +87,7 @@ struct gss_auth {
struct
list_head
upcalls
;
struct
rpc_clnt
*
client
;
struct
dentry
*
dentry
;
char
path
[
48
];
spinlock_t
lock
;
};
...
...
@@ -689,8 +690,10 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
if
(
err
)
goto
err_put_mech
;
gss_auth
->
dentry
=
rpc_mkpipe
(
clnt
->
cl_dentry
,
gss_auth
->
mech
->
gm_name
,
clnt
,
&
gss_upcall_ops
,
RPC_PIPE_WAIT_FOR_OPEN
);
snprintf
(
gss_auth
->
path
,
sizeof
(
gss_auth
->
path
),
"%s/%s"
,
clnt
->
cl_pathname
,
gss_auth
->
mech
->
gm_name
);
gss_auth
->
dentry
=
rpc_mkpipe
(
gss_auth
->
path
,
clnt
,
&
gss_upcall_ops
,
RPC_PIPE_WAIT_FOR_OPEN
);
if
(
IS_ERR
(
gss_auth
->
dentry
))
{
err
=
PTR_ERR
(
gss_auth
->
dentry
);
goto
err_put_mech
;
...
...
@@ -715,7 +718,7 @@ gss_destroy(struct rpc_auth *auth)
auth
,
auth
->
au_flavor
);
gss_auth
=
container_of
(
auth
,
struct
gss_auth
,
rpc_auth
);
rpc_unlink
(
gss_auth
->
dentry
);
rpc_unlink
(
gss_auth
->
path
);
gss_mech_put
(
gss_auth
->
mech
);
rpcauth_free_credcache
(
auth
);
...
...
net/sunrpc/clnt.c
浏览文件 @
f134585a
...
...
@@ -67,42 +67,26 @@ static u32 * call_verify(struct rpc_task *task);
static
int
rpc_setup_pipedir
(
struct
rpc_clnt
*
clnt
,
char
*
dir_name
)
{
static
unsigned
int
clntid
;
char
name
[
128
];
static
uint32_t
clntid
;
int
error
;
if
(
dir_name
==
NULL
)
return
0
;
retry_parent:
clnt
->
__cl_parent_dentry
=
rpc_mkdir
(
NULL
,
dir_name
,
NULL
);
if
(
IS_ERR
(
clnt
->
__cl_parent_dentry
))
{
error
=
PTR_ERR
(
clnt
->
__cl_parent_dentry
);
if
(
error
==
-
EEXIST
)
goto
retry_parent
;
/* XXX(hch): WTF? */
printk
(
KERN_INFO
"RPC: Couldn't create pipefs entry %s, error %d
\n
"
,
dir_name
,
error
);
return
error
;
}
retry_child:
snprintf
(
name
,
sizeof
(
name
),
"clnt%x"
,
clntid
++
);
name
[
sizeof
(
name
)
-
1
]
=
'\0'
;
clnt
->
cl_dentry
=
rpc_mkdir
(
clnt
->
__cl_parent_dentry
,
name
,
clnt
);
if
(
IS_ERR
(
clnt
->
cl_dentry
))
{
for
(;;)
{
snprintf
(
clnt
->
cl_pathname
,
sizeof
(
clnt
->
cl_pathname
),
"%s/clnt%x"
,
dir_name
,
(
unsigned
int
)
clntid
++
);
clnt
->
cl_pathname
[
sizeof
(
clnt
->
cl_pathname
)
-
1
]
=
'\0'
;
clnt
->
cl_dentry
=
rpc_mkdir
(
clnt
->
cl_pathname
,
clnt
);
if
(
!
IS_ERR
(
clnt
->
cl_dentry
))
return
0
;
error
=
PTR_ERR
(
clnt
->
cl_dentry
);
if
(
error
==
-
EEXIST
)
goto
retry_child
;
printk
(
KERN_INFO
"RPC: Couldn't create pipefs entry %s, error %d
\n
"
,
name
,
error
);
rpc_rmdir
(
clnt
->
__cl_parent_dentry
);
return
error
;
if
(
error
!=
-
EEXIST
)
{
printk
(
KERN_INFO
"RPC: Couldn't create pipefs entry %s, error %d
\n
"
,
clnt
->
cl_pathname
,
error
);
return
error
;
}
}
return
0
;
}
/*
...
...
@@ -190,8 +174,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
return
clnt
;
out_no_auth:
rpc_rmdir
(
clnt
->
cl_dentry
);
rpc_rmdir
(
clnt
->
__cl_parent_dentry
);
rpc_rmdir
(
clnt
->
cl_pathname
);
out_no_path:
if
(
clnt
->
cl_server
!=
clnt
->
cl_inline_name
)
kfree
(
clnt
->
cl_server
);
...
...
@@ -319,10 +302,8 @@ rpc_destroy_client(struct rpc_clnt *clnt)
rpc_destroy_client
(
clnt
->
cl_parent
);
goto
out_free
;
}
if
(
clnt
->
cl_dentry
)
rpc_rmdir
(
clnt
->
cl_dentry
);
if
(
clnt
->
__cl_parent_dentry
)
rpc_rmdir
(
clnt
->
__cl_parent_dentry
);
if
(
clnt
->
cl_pathname
[
0
])
rpc_rmdir
(
clnt
->
cl_pathname
);
if
(
clnt
->
cl_xprt
)
{
xprt_destroy
(
clnt
->
cl_xprt
);
clnt
->
cl_xprt
=
NULL
;
...
...
net/sunrpc/rpc_pipe.c
浏览文件 @
f134585a
...
...
@@ -414,6 +414,38 @@ rpc_put_mount(void)
simple_release_fs
(
&
rpc_mount
,
&
rpc_mount_count
);
}
static
int
rpc_lookup_parent
(
char
*
path
,
struct
nameidata
*
nd
)
{
if
(
path
[
0
]
==
'\0'
)
return
-
ENOENT
;
if
(
rpc_get_mount
())
{
printk
(
KERN_WARNING
"%s: %s failed to mount "
"pseudofilesystem
\n
"
,
__FILE__
,
__FUNCTION__
);
return
-
ENODEV
;
}
nd
->
mnt
=
mntget
(
rpc_mount
);
nd
->
dentry
=
dget
(
rpc_mount
->
mnt_root
);
nd
->
last_type
=
LAST_ROOT
;
nd
->
flags
=
LOOKUP_PARENT
;
nd
->
depth
=
0
;
if
(
path_walk
(
path
,
nd
))
{
printk
(
KERN_WARNING
"%s: %s failed to find path %s
\n
"
,
__FILE__
,
__FUNCTION__
,
path
);
rpc_put_mount
();
return
-
ENOENT
;
}
return
0
;
}
static
void
rpc_release_path
(
struct
nameidata
*
nd
)
{
path_release
(
nd
);
rpc_put_mount
();
}
static
struct
inode
*
rpc_get_inode
(
struct
super_block
*
sb
,
int
mode
)
{
...
...
@@ -518,149 +550,197 @@ rpc_populate(struct dentry *parent,
return
-
ENOMEM
;
}
st
ruct
dentry
*
rpc_mkdir
(
struct
dentry
*
parent
,
char
*
name
,
struct
rpc_clnt
*
rpc_client
)
st
atic
int
__rpc_mkdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
)
{
struct
inode
*
dir
;
struct
dentry
*
dentry
;
struct
inode
*
inode
;
inode
=
rpc_get_inode
(
dir
->
i_sb
,
S_IFDIR
|
S_IRUSR
|
S_IXUSR
);
if
(
!
inode
)
goto
out_err
;
inode
->
i_ino
=
iunique
(
dir
->
i_sb
,
100
);
d_instantiate
(
dentry
,
inode
);
dir
->
i_nlink
++
;
inode_dir_notify
(
dir
,
DN_CREATE
);
rpc_get_mount
();
return
0
;
out_err:
printk
(
KERN_WARNING
"%s: %s failed to allocate inode for dentry %s
\n
"
,
__FILE__
,
__FUNCTION__
,
dentry
->
d_name
.
name
);
return
-
ENOMEM
;
}
static
int
__rpc_rmdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
)
{
int
error
;
if
(
!
parent
)
parent
=
rpc_mount
->
mnt_root
;
shrink_dcache_parent
(
dentry
);
if
(
dentry
->
d_inode
)
{
rpc_close_pipes
(
dentry
->
d_inode
);
rpc_inode_setowner
(
dentry
->
d_inode
,
NULL
);
}
if
((
error
=
simple_rmdir
(
dir
,
dentry
))
!=
0
)
return
error
;
if
(
!
error
)
{
inode_dir_notify
(
dir
,
DN_DELETE
);
d_drop
(
dentry
);
rpc_put_mount
();
}
return
0
;
}
dir
=
parent
->
d_inode
;
error
=
rpc_get_mount
();
if
(
error
)
return
ERR_PTR
(
error
);
static
struct
dentry
*
rpc_lookup_negative
(
char
*
path
,
struct
nameidata
*
nd
)
{
struct
dentry
*
dentry
;
struct
inode
*
dir
;
int
error
;
if
((
error
=
rpc_lookup_parent
(
path
,
nd
))
!=
0
)
return
ERR_PTR
(
error
);
dir
=
nd
->
dentry
->
d_inode
;
down
(
&
dir
->
i_sem
);
dentry
=
lookup_
one_len
(
name
,
parent
,
strlen
(
name
)
);
dentry
=
lookup_
hash
(
&
nd
->
last
,
nd
->
dentry
);
if
(
IS_ERR
(
dentry
))
goto
out_
unlock
;
goto
out_
err
;
if
(
dentry
->
d_inode
)
{
dput
(
dentry
);
dentry
=
ERR_PTR
(
-
EEXIST
);
goto
out_
dput
;
goto
out_
err
;
}
inode
=
rpc_get_inode
(
dir
->
i_sb
,
S_IFDIR
|
S_IRUSR
|
S_IXUSR
);
if
(
!
inode
)
goto
out_dput
;
inode
->
i_ino
=
iunique
(
dir
->
i_sb
,
100
);
dir
->
i_nlink
++
;
RPC_I
(
dentry
->
d_inode
)
->
private
=
rpc_client
;
d_instantiate
(
dentry
,
inode
);
dget
(
dentry
);
return
dentry
;
out_err:
up
(
&
dir
->
i_sem
);
rpc_release_path
(
nd
);
return
dentry
;
}
inode_dir_notify
(
dir
,
DN_CREATE
);
struct
dentry
*
rpc_mkdir
(
char
*
path
,
struct
rpc_clnt
*
rpc_client
)
{
struct
nameidata
nd
;
struct
dentry
*
dentry
;
struct
inode
*
dir
;
int
error
;
dentry
=
rpc_lookup_negative
(
path
,
&
nd
);
if
(
IS_ERR
(
dentry
))
return
dentry
;
dir
=
nd
.
dentry
->
d_inode
;
if
((
error
=
__rpc_mkdir
(
dir
,
dentry
))
!=
0
)
goto
err_dput
;
RPC_I
(
dentry
->
d_inode
)
->
private
=
rpc_client
;
error
=
rpc_populate
(
dentry
,
authfiles
,
RPCAUTH_info
,
RPCAUTH_EOF
);
if
(
error
)
goto
out_depopulate
;
return
dentry
;
out_depopulate:
rpc_rmdir
(
dentry
);
out_dput:
dput
(
dentry
);
out_unlock:
goto
err_depopulate
;
out:
up
(
&
dir
->
i_sem
);
rpc_
put_mount
(
);
rpc_
release_path
(
&
nd
);
return
dentry
;
err_depopulate:
rpc_depopulate
(
dentry
);
__rpc_rmdir
(
dir
,
dentry
);
err_dput:
dput
(
dentry
);
printk
(
KERN_WARNING
"%s: %s() failed to create directory %s (errno = %d)
\n
"
,
__FILE__
,
__FUNCTION__
,
path
,
error
);
dentry
=
ERR_PTR
(
error
);
goto
out
;
}
void
rpc_rmdir
(
struct
dentry
*
dentry
)
int
rpc_rmdir
(
char
*
path
)
{
struct
dentry
*
parent
=
dentry
->
d_parent
;
rpc_depopulate
(
dentry
);
struct
nameidata
nd
;
struct
dentry
*
dentry
;
struct
inode
*
dir
;
int
error
;
down
(
&
parent
->
d_inode
->
i_sem
);
if
(
dentry
->
d_inode
)
{
rpc_close_pipes
(
dentry
->
d_inode
);
rpc_inode_setowner
(
dentry
->
d_inode
,
NULL
);
simple_rmdir
(
parent
->
d_inode
,
dentry
);
if
((
error
=
rpc_lookup_parent
(
path
,
&
nd
))
!=
0
)
return
error
;
dir
=
nd
.
dentry
->
d_inode
;
down
(
&
dir
->
i_sem
);
dentry
=
lookup_hash
(
&
nd
.
last
,
nd
.
dentry
);
if
(
IS_ERR
(
dentry
))
{
error
=
PTR_ERR
(
dentry
);
goto
out_release
;
}
up
(
&
parent
->
d_inode
->
i_sem
);
inode_dir_notify
(
parent
->
d_inode
,
DN_DELETE
);
rpc_put_mount
();
rpc_depopulate
(
dentry
);
error
=
__rpc_rmdir
(
dir
,
dentry
);
dput
(
dentry
);
out_release:
up
(
&
dir
->
i_sem
);
rpc_release_path
(
&
nd
);
return
error
;
}
struct
dentry
*
rpc_mkpipe
(
struct
dentry
*
parent
,
char
*
name
,
void
*
private
,
struct
rpc_pipe_ops
*
ops
,
int
flags
)
rpc_mkpipe
(
char
*
path
,
void
*
private
,
struct
rpc_pipe_ops
*
ops
,
int
flags
)
{
struct
inode
*
dir
=
parent
->
d_inode
;
struct
nameidata
nd
;
struct
dentry
*
dentry
;
struct
inode
*
inode
;
struct
inode
*
dir
,
*
inode
;
struct
rpc_inode
*
rpci
;
int
error
;
error
=
rpc_get_mount
();
if
(
error
)
return
ERR_PTR
(
error
);
down
(
&
parent
->
d_inode
->
i_sem
);
dentry
=
lookup_one_len
(
name
,
parent
,
strlen
(
name
));
dentry
=
rpc_lookup_negative
(
path
,
&
nd
);
if
(
IS_ERR
(
dentry
))
goto
out_unlock
;
if
(
dentry
->
d_inode
)
{
dentry
=
ERR_PTR
(
-
EEXIST
);
goto
out_dput
;
}
inode
=
rpc_get_inode
(
parent
->
d_inode
->
i_sb
,
S_IFSOCK
|
S_IRUSR
|
S_IWUSR
);
if
(
!
inode
)
{
dentry
=
ERR_PTR
(
-
ENOMEM
);
goto
out_dput
;
}
return
dentry
;
dir
=
nd
.
dentry
->
d_inode
;
inode
=
rpc_get_inode
(
dir
->
i_sb
,
S_IFSOCK
|
S_IRUSR
|
S_IWUSR
);
if
(
!
inode
)
goto
err_dput
;
inode
->
i_ino
=
iunique
(
dir
->
i_sb
,
100
);
inode
->
i_fop
=
&
rpc_pipe_fops
;
d_instantiate
(
dentry
,
inode
);
rpci
=
RPC_I
(
inode
);
rpci
->
private
=
private
;
rpci
->
flags
=
flags
;
rpci
->
ops
=
ops
;
d_instantiate
(
dentry
,
inode
);
dget
(
dentry
);
up
(
&
parent
->
d_inode
->
i_sem
);
inode_dir_notify
(
dir
,
DN_CREATE
);
out:
up
(
&
dir
->
i_sem
);
rpc_release_path
(
&
nd
);
return
dentry
;
out_dput:
err_dput:
dput
(
dentry
);
out_unlock:
up
(
&
parent
->
d_inode
->
i_sem
);
rpc_put_mount
(
);
return
dentry
;
dentry
=
ERR_PTR
(
-
ENOMEM
);
printk
(
KERN_WARNING
"%s: %s() failed to create pipe %s (errno = %d)
\n
"
,
__FILE__
,
__FUNCTION__
,
path
,
-
ENOMEM
);
goto
out
;
}
void
rpc_unlink
(
struct
dentry
*
dentry
)
int
rpc_unlink
(
char
*
path
)
{
struct
dentry
*
parent
=
dentry
->
d_parent
;
struct
nameidata
nd
;
struct
dentry
*
dentry
;
struct
inode
*
dir
;
int
error
;
down
(
&
parent
->
d_inode
->
i_sem
);
if
((
error
=
rpc_lookup_parent
(
path
,
&
nd
))
!=
0
)
return
error
;
dir
=
nd
.
dentry
->
d_inode
;
down
(
&
dir
->
i_sem
);
dentry
=
lookup_hash
(
&
nd
.
last
,
nd
.
dentry
);
if
(
IS_ERR
(
dentry
))
{
error
=
PTR_ERR
(
dentry
);
goto
out_release
;
}
d_drop
(
dentry
);
if
(
dentry
->
d_inode
)
{
rpc_close_pipes
(
dentry
->
d_inode
);
rpc_inode_setowner
(
dentry
->
d_inode
,
NULL
);
simple_unlink
(
parent
->
d_inode
,
dentry
);
error
=
simple_unlink
(
dir
,
dentry
);
}
up
(
&
parent
->
d_inode
->
i_sem
);
inode_dir_notify
(
parent
->
d_inode
,
DN_DELETE
);
rpc_put_mount
();
dput
(
dentry
);
inode_dir_notify
(
dir
,
DN_DELETE
);
out_release:
up
(
&
dir
->
i_sem
);
rpc_release_path
(
&
nd
);
return
error
;
}
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录