From fd466203825f79aadff355cc372ba8a3d2dcd39b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 18 Mar 2006 13:26:44 -0500 Subject: [PATCH] --- yaml --- r: 21117 b: refs/heads/master c: a6a0763a60eef374d4f02f82a6ecb6a74f380fcb h: refs/heads/master i: 21115: 6970196677411383b946fb0e938ee3b9082cb823 v: v3 --- [refs] | 2 +- trunk/block/cfq-iosched.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 484d3629011e..89205a5ecd40 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 12a057321529df2fb650ac5f34dfd7abcca667df +refs/heads/master: a6a0763a60eef374d4f02f82a6ecb6a74f380fcb diff --git a/trunk/block/cfq-iosched.c b/trunk/block/cfq-iosched.c index 63bfe4b494ba..3bacf4bb7dd2 100644 --- a/trunk/block/cfq-iosched.c +++ b/trunk/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; }