summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-03-18 13:26:44 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2006-03-18 18:34:04 -0500
commita6a0763a60eef374d4f02f82a6ecb6a74f380fcb (patch)
treeab6811f034eb2839ee07bc8e251b96a1aba313f7 /block
parent12a057321529df2fb650ac5f34dfd7abcca667df (diff)
downloadop-kernel-dev-a6a0763a60eef374d4f02f82a6ecb6a74f380fcb.zip
op-kernel-dev-a6a0763a60eef374d4f02f82a6ecb6a74f380fcb.tar.gz
[PATCH] fix the exclusion for ioprio_set()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block')
-rw-r--r--block/cfq-iosched.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 63bfe4b..3bacf4b 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -47,6 +47,8 @@ static int cfq_slice_idle = HZ / 100;
*/
static const int cfq_max_depth = 2;
+static DEFINE_RWLOCK(cfq_exit_lock);
+
/*
* for the hash of cfqq inside the cfqd
*/
@@ -1354,13 +1356,19 @@ static inline void changed_ioprio(struct cfq_io_context *cic)
*/
static int cfq_ioc_set_ioprio(struct io_context *ioc, unsigned int ioprio)
{
- struct cfq_io_context *cic = ioc->cic;
+ struct cfq_io_context *cic;
+
+ write_lock(&cfq_exit_lock);
+
+ cic = ioc->cic;
changed_ioprio(cic);
list_for_each_entry(cic, &cic->list, list)
changed_ioprio(cic);
+ write_unlock(&cfq_exit_lock);
+
return 0;
}
@@ -1450,8 +1458,10 @@ cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, gfp_t gfp_mask)
*/
cic->ioc = ioc;
cic->key = cfqd;
+ read_lock(&cfq_exit_lock);
ioc->set_ioprio = cfq_ioc_set_ioprio;
ioc->cic = cic;
+ read_unlock(&cfq_exit_lock);
} else {
struct cfq_io_context *__cic;
@@ -1487,7 +1497,9 @@ cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, gfp_t gfp_mask)
__cic->ioc = ioc;
__cic->key = cfqd;
+ read_lock(&cfq_exit_lock);
list_add(&__cic->list, &cic->list);
+ read_unlock(&cfq_exit_lock);
cic = __cic;
}
OpenPOWER on IntegriCloud