diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-14 21:52:02 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-14 21:52:02 -0800 |
commit | c984833d0bb291f40953c495cc1031cfb50ca1bf (patch) | |
tree | 61304220e902403da310d5089f21dac4e01faf45 | |
parent | 2677d7d38f465ca9c8c33619a46bf4fe2852c39d (diff) |
bcache: fix a shutdown deadlock
-rw-r--r-- | drivers/md/bcache/move.c | 2 | ||||
-rw-r--r-- | drivers/md/bcache/util.c | 7 | ||||
-rw-r--r-- | drivers/md/bcache/util.h | 3 | ||||
-rw-r--r-- | drivers/md/bcache/writeback.c | 3 |
4 files changed, 5 insertions, 10 deletions
diff --git a/drivers/md/bcache/move.c b/drivers/md/bcache/move.c index a534b0a62801..589cf4eb0134 100644 --- a/drivers/md/bcache/move.c +++ b/drivers/md/bcache/move.c @@ -333,7 +333,7 @@ int bch_move_ctxt_wait(struct moving_context *ctxt) ctxt->max_sectors_in_flight); return ctxt->rate - ? bch_ratelimit_wait_freezable_stoppable(ctxt->rate, &ctxt->cl) + ? bch_ratelimit_wait_freezable_stoppable(ctxt->rate) : 0; } diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index 70c26e2e8561..6eebad70be7b 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -236,8 +236,7 @@ void bch_ratelimit_increment(struct bch_ratelimit *d, u64 done) d->next = now - NSEC_PER_SEC * 2; } -int bch_ratelimit_wait_freezable_stoppable(struct bch_ratelimit *d, - struct closure *cl) +int bch_ratelimit_wait_freezable_stoppable(struct bch_ratelimit *d) { while (1) { u64 delay = bch_ratelimit_delay(d); @@ -245,10 +244,8 @@ int bch_ratelimit_wait_freezable_stoppable(struct bch_ratelimit *d, if (delay) set_current_state(TASK_INTERRUPTIBLE); - if (kthread_should_stop()) { - closure_sync(cl); + if (kthread_should_stop()) return 1; - } if (!delay) return 0; diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h index 0c21452f9d76..69345bd30d93 100644 --- a/drivers/md/bcache/util.h +++ b/drivers/md/bcache/util.h @@ -418,8 +418,7 @@ static inline void bch_ratelimit_reset(struct bch_ratelimit *d) u64 bch_ratelimit_delay(struct bch_ratelimit *); void bch_ratelimit_increment(struct bch_ratelimit *, u64); -int bch_ratelimit_wait_freezable_stoppable(struct bch_ratelimit *, - struct closure *); +int bch_ratelimit_wait_freezable_stoppable(struct bch_ratelimit *); struct bch_pd_controller { struct bch_ratelimit rate; diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index cb7bc86a5a3d..600bfbfba379 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -200,8 +200,7 @@ static u64 read_dirty(struct cached_dev *dc) closure_init_stack(&cl); - while (!bch_ratelimit_wait_freezable_stoppable(&dc->writeback_pd.rate, - &cl)) { + while (!bch_ratelimit_wait_freezable_stoppable(&dc->writeback_pd.rate)) { w = bch_keybuf_next(&dc->writeback_keys); if (!w) break; |