Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
ec073428
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
ec073428
编写于
10月 20, 2005
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NFSv4: Fix up locking for nfs4_state_owner
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
4e51336a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
5 deletion
+18
-5
fs/nfs/nfs4_fs.h
fs/nfs/nfs4_fs.h
+1
-0
fs/nfs/nfs4proc.c
fs/nfs/nfs4proc.c
+2
-0
fs/nfs/nfs4state.c
fs/nfs/nfs4state.c
+15
-5
未找到文件。
fs/nfs/nfs4_fs.h
浏览文件 @
ec073428
...
...
@@ -126,6 +126,7 @@ static inline void nfs_confirm_seqid(struct nfs_seqid_counter *seqid, int status
* semantics by allowing the server to identify replayed requests.
*/
struct
nfs4_state_owner
{
spinlock_t
so_lock
;
struct
list_head
so_list
;
/* per-clientid list of state_owners */
struct
nfs4_client
*
so_client
;
u32
so_id
;
/* 32-bit identifier, unique */
...
...
fs/nfs/nfs4proc.c
浏览文件 @
ec073428
...
...
@@ -212,6 +212,7 @@ static void update_open_stateid(struct nfs4_state *state, nfs4_stateid *stateid,
open_flags
&=
(
FMODE_READ
|
FMODE_WRITE
);
/* Protect against nfs4_find_state() */
spin_lock
(
&
state
->
owner
->
so_lock
);
spin_lock
(
&
inode
->
i_lock
);
state
->
state
|=
open_flags
;
/* NB! List reordering - see the reclaim code for why. */
...
...
@@ -221,6 +222,7 @@ static void update_open_stateid(struct nfs4_state *state, nfs4_stateid *stateid,
state
->
nreaders
++
;
memcpy
(
&
state
->
stateid
,
stateid
,
sizeof
(
state
->
stateid
));
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
state
->
owner
->
so_lock
);
}
/*
...
...
fs/nfs/nfs4state.c
浏览文件 @
ec073428
...
...
@@ -267,6 +267,7 @@ nfs4_alloc_state_owner(void)
sp
=
kzalloc
(
sizeof
(
*
sp
),
GFP_KERNEL
);
if
(
!
sp
)
return
NULL
;
spin_lock_init
(
&
sp
->
so_lock
);
INIT_LIST_HEAD
(
&
sp
->
so_states
);
INIT_LIST_HEAD
(
&
sp
->
so_delegations
);
rpc_init_wait_queue
(
&
sp
->
so_sequence
.
wait
,
"Seqid_waitqueue"
);
...
...
@@ -438,20 +439,23 @@ nfs4_get_open_state(struct inode *inode, struct nfs4_state_owner *owner)
if
(
state
)
goto
out
;
new
=
nfs4_alloc_open_state
();
spin_lock
(
&
owner
->
so_lock
);
spin_lock
(
&
inode
->
i_lock
);
state
=
__nfs4_find_state_byowner
(
inode
,
owner
);
if
(
state
==
NULL
&&
new
!=
NULL
)
{
state
=
new
;
/* Note: The reclaim code dictates that we add stateless
* and read-only stateids to the end of the list */
list_add_tail
(
&
state
->
open_states
,
&
owner
->
so_states
);
state
->
owner
=
owner
;
atomic_inc
(
&
owner
->
so_count
);
list_add
(
&
state
->
inode_states
,
&
nfsi
->
open_states
);
state
->
inode
=
igrab
(
inode
);
spin_unlock
(
&
inode
->
i_lock
);
/* Note: The reclaim code dictates that we add stateless
* and read-only stateids to the end of the list */
list_add_tail
(
&
state
->
open_states
,
&
owner
->
so_states
);
spin_unlock
(
&
owner
->
so_lock
);
}
else
{
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
owner
->
so_lock
);
if
(
new
)
nfs4_free_open_state
(
new
);
}
...
...
@@ -468,12 +472,14 @@ void nfs4_put_open_state(struct nfs4_state *state)
struct
inode
*
inode
=
state
->
inode
;
struct
nfs4_state_owner
*
owner
=
state
->
owner
;
if
(
!
atomic_dec_and_lock
(
&
state
->
count
,
&
inode
->
i
_lock
))
if
(
!
atomic_dec_and_lock
(
&
state
->
count
,
&
owner
->
so
_lock
))
return
;
spin_lock
(
&
inode
->
i_lock
);
if
(
!
list_empty
(
&
state
->
inode_states
))
list_del
(
&
state
->
inode_states
);
spin_unlock
(
&
inode
->
i_lock
);
list_del
(
&
state
->
open_states
);
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
owner
->
so_lock
);
iput
(
inode
);
BUG_ON
(
state
->
state
!=
0
);
nfs4_free_open_state
(
state
);
...
...
@@ -491,6 +497,7 @@ void nfs4_close_state(struct nfs4_state *state, mode_t mode)
atomic_inc
(
&
owner
->
so_count
);
/* Protect against nfs4_find_state() */
spin_lock
(
&
owner
->
so_lock
);
spin_lock
(
&
inode
->
i_lock
);
if
(
mode
&
FMODE_READ
)
state
->
nreaders
--
;
...
...
@@ -503,6 +510,7 @@ void nfs4_close_state(struct nfs4_state *state, mode_t mode)
list_move_tail
(
&
state
->
open_states
,
&
owner
->
so_states
);
}
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
owner
->
so_lock
);
newstate
=
0
;
if
(
state
->
state
!=
0
)
{
if
(
state
->
nreaders
)
...
...
@@ -899,6 +907,7 @@ static void nfs4_state_mark_reclaim(struct nfs4_client *clp)
list_for_each_entry
(
sp
,
&
clp
->
cl_state_owners
,
so_list
)
{
sp
->
so_seqid
.
counter
=
0
;
sp
->
so_seqid
.
flags
=
0
;
spin_lock
(
&
sp
->
so_lock
);
list_for_each_entry
(
state
,
&
sp
->
so_states
,
open_states
)
{
list_for_each_entry
(
lock
,
&
state
->
lock_states
,
ls_locks
)
{
lock
->
ls_seqid
.
counter
=
0
;
...
...
@@ -906,6 +915,7 @@ static void nfs4_state_mark_reclaim(struct nfs4_client *clp)
lock
->
ls_flags
&=
~
NFS_LOCK_INITIALIZED
;
}
}
spin_unlock
(
&
sp
->
so_lock
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录