diff options
author | Nicholas Swenson <nks@daterainc.com> | 2014-01-09 19:03:04 -0500 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-03-18 15:22:33 -0400 |
commit | da415a096fc06e49d1a15f7a06bcfe6ad44c5d38 (patch) | |
tree | 54a5b937d4acd579f43b9dc062afd41ecaa33d82 /drivers/md/bcache/movinggc.c | |
parent | 90db6919f5f1614d1b7a92052445506bc6c564d2 (diff) |
bcache: Fix moving_gc deadlocking with a foreground write
Deadlock happened because a foreground write slept, waiting for a bucket
to be allocated. Normally the gc would mark buckets available for invalidation.
But the moving_gc was stuck waiting for outstanding writes to complete.
These writes used the bcache_wq, the same queue foreground writes used.
This fix gives moving_gc its own work queue, so it was still finish moving
even if foreground writes are stuck waiting for allocation. It also makes
work queue a parameter to the data_insert path, so moving_gc can use its
workqueue for writes.
Signed-off-by: Nicholas Swenson <nks@daterainc.com>
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/movinggc.c')
-rw-r--r-- | drivers/md/bcache/movinggc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c index 9eb60d102de8..8c7205186d08 100644 --- a/drivers/md/bcache/movinggc.c +++ b/drivers/md/bcache/movinggc.c | |||
@@ -115,7 +115,7 @@ static void write_moving(struct closure *cl) | |||
115 | closure_call(&op->cl, bch_data_insert, NULL, cl); | 115 | closure_call(&op->cl, bch_data_insert, NULL, cl); |
116 | } | 116 | } |
117 | 117 | ||
118 | continue_at(cl, write_moving_finish, system_wq); | 118 | continue_at(cl, write_moving_finish, op->wq); |
119 | } | 119 | } |
120 | 120 | ||
121 | static void read_moving_submit(struct closure *cl) | 121 | static void read_moving_submit(struct closure *cl) |
@@ -125,7 +125,7 @@ static void read_moving_submit(struct closure *cl) | |||
125 | 125 | ||
126 | bch_submit_bbio(bio, io->op.c, &io->w->key, 0); | 126 | bch_submit_bbio(bio, io->op.c, &io->w->key, 0); |
127 | 127 | ||
128 | continue_at(cl, write_moving, system_wq); | 128 | continue_at(cl, write_moving, io->op.wq); |
129 | } | 129 | } |
130 | 130 | ||
131 | static void read_moving(struct cache_set *c) | 131 | static void read_moving(struct cache_set *c) |
@@ -160,6 +160,7 @@ static void read_moving(struct cache_set *c) | |||
160 | io->w = w; | 160 | io->w = w; |
161 | io->op.inode = KEY_INODE(&w->key); | 161 | io->op.inode = KEY_INODE(&w->key); |
162 | io->op.c = c; | 162 | io->op.c = c; |
163 | io->op.wq = c->moving_gc_wq; | ||
163 | 164 | ||
164 | moving_init(io); | 165 | moving_init(io); |
165 | bio = &io->bio.bio; | 166 | bio = &io->bio.bio; |