diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-18 13:26:44 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-18 18:34:04 -0500 |
commit | a6a0763a60eef374d4f02f82a6ecb6a74f380fcb (patch) | |
tree | ab6811f034eb2839ee07bc8e251b96a1aba313f7 | |
parent | 12a057321529df2fb650ac5f34dfd7abcca667df (diff) |
[PATCH] fix the exclusion for ioprio_set()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | block/cfq-iosched.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 63bfe4b494ba..3bacf4bb7dd2 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -47,6 +47,8 @@ static int cfq_slice_idle = HZ / 100; | |||
47 | */ | 47 | */ |
48 | static const int cfq_max_depth = 2; | 48 | static const int cfq_max_depth = 2; |
49 | 49 | ||
50 | static DEFINE_RWLOCK(cfq_exit_lock); | ||
51 | |||
50 | /* | 52 | /* |
51 | * for the hash of cfqq inside the cfqd | 53 | * for the hash of cfqq inside the cfqd |
52 | */ | 54 | */ |
@@ -1354,13 +1356,19 @@ static inline void changed_ioprio(struct cfq_io_context *cic) | |||
1354 | */ | 1356 | */ |
1355 | static int cfq_ioc_set_ioprio(struct io_context *ioc, unsigned int ioprio) | 1357 | static int cfq_ioc_set_ioprio(struct io_context *ioc, unsigned int ioprio) |
1356 | { | 1358 | { |
1357 | struct cfq_io_context *cic = ioc->cic; | 1359 | struct cfq_io_context *cic; |
1360 | |||
1361 | write_lock(&cfq_exit_lock); | ||
1362 | |||
1363 | cic = ioc->cic; | ||
1358 | 1364 | ||
1359 | changed_ioprio(cic); | 1365 | changed_ioprio(cic); |
1360 | 1366 | ||
1361 | list_for_each_entry(cic, &cic->list, list) | 1367 | list_for_each_entry(cic, &cic->list, list) |
1362 | changed_ioprio(cic); | 1368 | changed_ioprio(cic); |
1363 | 1369 | ||
1370 | write_unlock(&cfq_exit_lock); | ||
1371 | |||
1364 | return 0; | 1372 | return 0; |
1365 | } | 1373 | } |
1366 | 1374 | ||
@@ -1450,8 +1458,10 @@ cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, gfp_t gfp_mask) | |||
1450 | */ | 1458 | */ |
1451 | cic->ioc = ioc; | 1459 | cic->ioc = ioc; |
1452 | cic->key = cfqd; | 1460 | cic->key = cfqd; |
1461 | read_lock(&cfq_exit_lock); | ||
1453 | ioc->set_ioprio = cfq_ioc_set_ioprio; | 1462 | ioc->set_ioprio = cfq_ioc_set_ioprio; |
1454 | ioc->cic = cic; | 1463 | ioc->cic = cic; |
1464 | read_unlock(&cfq_exit_lock); | ||
1455 | } else { | 1465 | } else { |
1456 | struct cfq_io_context *__cic; | 1466 | struct cfq_io_context *__cic; |
1457 | 1467 | ||
@@ -1487,7 +1497,9 @@ cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, gfp_t gfp_mask) | |||
1487 | 1497 | ||
1488 | __cic->ioc = ioc; | 1498 | __cic->ioc = ioc; |
1489 | __cic->key = cfqd; | 1499 | __cic->key = cfqd; |
1500 | read_lock(&cfq_exit_lock); | ||
1490 | list_add(&__cic->list, &cic->list); | 1501 | list_add(&__cic->list, &cic->list); |
1502 | read_unlock(&cfq_exit_lock); | ||
1491 | cic = __cic; | 1503 | cic = __cic; |
1492 | } | 1504 | } |
1493 | 1505 | ||