Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
334e94de
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
334e94de
编写于
3月 18, 2006
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] deal with rmmod/put_io_context() races
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
e17a9489
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
1 deletion
+32
-1
block/as-iosched.c
block/as-iosched.c
+14
-1
block/cfq-iosched.c
block/cfq-iosched.c
+16
-0
block/ll_rw_blk.c
block/ll_rw_blk.c
+2
-0
未找到文件。
block/as-iosched.c
浏览文件 @
334e94de
...
...
@@ -182,6 +182,9 @@ struct as_rq {
static
kmem_cache_t
*
arq_pool
;
static
atomic_t
ioc_count
=
ATOMIC_INIT
(
0
);
static
struct
completion
*
ioc_gone
;
static
void
as_move_to_dispatch
(
struct
as_data
*
ad
,
struct
as_rq
*
arq
);
static
void
as_antic_stop
(
struct
as_data
*
ad
);
...
...
@@ -193,11 +196,14 @@ static void as_antic_stop(struct as_data *ad);
static
void
free_as_io_context
(
struct
as_io_context
*
aic
)
{
kfree
(
aic
);
if
(
atomic_dec_and_test
(
&
ioc_count
)
&&
ioc_gone
)
complete
(
ioc_gone
);
}
static
void
as_trim
(
struct
io_context
*
ioc
)
{
kfree
(
ioc
->
aic
);
if
(
ioc
->
aic
)
free_as_io_context
(
ioc
->
aic
);
ioc
->
aic
=
NULL
;
}
...
...
@@ -226,6 +232,7 @@ static struct as_io_context *alloc_as_io_context(void)
ret
->
seek_total
=
0
;
ret
->
seek_samples
=
0
;
ret
->
seek_mean
=
0
;
atomic_inc
(
&
ioc_count
);
}
return
ret
;
...
...
@@ -1900,7 +1907,13 @@ static int __init as_init(void)
static
void
__exit
as_exit
(
void
)
{
DECLARE_COMPLETION
(
all_gone
);
elv_unregister
(
&
iosched_as
);
ioc_gone
=
&
all_gone
;
barrier
();
if
(
atomic_read
(
&
ioc_count
))
complete
(
ioc_gone
);
synchronize_rcu
();
kmem_cache_destroy
(
arq_pool
);
}
...
...
block/cfq-iosched.c
浏览文件 @
334e94de
...
...
@@ -91,6 +91,9 @@ static kmem_cache_t *crq_pool;
static
kmem_cache_t
*
cfq_pool
;
static
kmem_cache_t
*
cfq_ioc_pool
;
static
atomic_t
ioc_count
=
ATOMIC_INIT
(
0
);
static
struct
completion
*
ioc_gone
;
#define CFQ_PRIO_LISTS IOPRIO_BE_NR
#define cfq_class_idle(cfqq) ((cfqq)->ioprio_class == IOPRIO_CLASS_IDLE)
#define cfq_class_be(cfqq) ((cfqq)->ioprio_class == IOPRIO_CLASS_BE)
...
...
@@ -1202,13 +1205,17 @@ static void cfq_free_io_context(struct cfq_io_context *cic)
{
struct
cfq_io_context
*
__cic
;
struct
list_head
*
entry
,
*
next
;
int
freed
=
1
;
list_for_each_safe
(
entry
,
next
,
&
cic
->
list
)
{
__cic
=
list_entry
(
entry
,
struct
cfq_io_context
,
list
);
kmem_cache_free
(
cfq_ioc_pool
,
__cic
);
freed
++
;
}
kmem_cache_free
(
cfq_ioc_pool
,
cic
);
if
(
atomic_sub_and_test
(
freed
,
&
ioc_count
)
&&
ioc_gone
)
complete
(
ioc_gone
);
}
static
void
cfq_trim
(
struct
io_context
*
ioc
)
...
...
@@ -1297,6 +1304,7 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
cic
->
dtor
=
cfq_free_io_context
;
cic
->
exit
=
cfq_exit_io_context
;
INIT_LIST_HEAD
(
&
cic
->
queue_list
);
atomic_inc
(
&
ioc_count
);
}
return
cic
;
...
...
@@ -1501,6 +1509,7 @@ cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, gfp_t gfp_mask)
list
);
read_unlock
(
&
cfq_exit_lock
);
kmem_cache_free
(
cfq_ioc_pool
,
cic
);
atomic_dec
(
&
ioc_count
);
goto
restart
;
}
...
...
@@ -1523,6 +1532,7 @@ cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, gfp_t gfp_mask)
list_del
(
&
__cic
->
list
);
read_unlock
(
&
cfq_exit_lock
);
kmem_cache_free
(
cfq_ioc_pool
,
__cic
);
atomic_dec
(
&
ioc_count
);
goto
restart
;
}
}
...
...
@@ -2510,7 +2520,13 @@ static int __init cfq_init(void)
static
void
__exit
cfq_exit
(
void
)
{
DECLARE_COMPLETION
(
all_gone
);
elv_unregister
(
&
iosched_cfq
);
ioc_gone
=
&
all_gone
;
barrier
();
if
(
atomic_read
(
&
ioc_count
))
complete
(
ioc_gone
);
synchronize_rcu
();
cfq_slab_kill
();
}
...
...
block/ll_rw_blk.c
浏览文件 @
334e94de
...
...
@@ -3477,10 +3477,12 @@ void put_io_context(struct io_context *ioc)
BUG_ON
(
atomic_read
(
&
ioc
->
refcount
)
==
0
);
if
(
atomic_dec_and_test
(
&
ioc
->
refcount
))
{
rcu_read_lock
();
if
(
ioc
->
aic
&&
ioc
->
aic
->
dtor
)
ioc
->
aic
->
dtor
(
ioc
->
aic
);
if
(
ioc
->
cic
&&
ioc
->
cic
->
dtor
)
ioc
->
cic
->
dtor
(
ioc
->
cic
);
rcu_read_unlock
();
kmem_cache_free
(
iocontext_cachep
,
ioc
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录