Tang Junhui
9baf30972b
bcache: fix for gc and write-back race
gc and write-back get raced (see the email "bcache get stucked" I sended
before):
gc thread write-back thread
| |bch_writeback_thread()
|bch_gc_thread() |
| |==>read_dirty()
|==>bch_btree_gc() |
|==>btree_root() //get btree root |
| //node write locker |
|==>bch_btree_gc_root() |
| |==>read_dirty_submit()
| |==>write_dirty()
| |==>continue_at(cl,
| | write_dirty_finish,
| | system_wq);
| |==>write_dirty_finish()//excute
| | //in system_wq
| |==>bch_btree_insert()
| |==>bch_btree_map_leaf_nodes()
| |==>__bch_btree_map_nodes()
| |==>btree_root //try to get btree
| | //root node read
| | //lock
| |-----stuck here
|==>bch_btree_set_root()
|==>bch_journal_meta()
|==>bch_journal()
|==>journal_try_write()
|==>journal_write_unlocked() //journal_full(&c->journal)
| //condition satisfied
|==>continue_at(cl, journal_write, system_wq); //try to excute
| //journal_write in system_wq
| //but work queue is excuting
| //write_dirty_finish()
|==>closure_sync(); //wait journal_write execute
| //over and wake up gc,
|-------------stuck here
|==>release root node write locker
This patch alloc a separate work-queue for write-back thread to avoid such
race.
(Commit log re-organized by Coly Li to pass checkpatch.pl checking)
Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn>
Acked-by: Coly Li <colyli@suse.de>
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2017-09-06 08:17:33 -06:00
..
2017-09-06 08:17:33 -06:00
2017-05-15 15:09:50 -04:00
2017-07-10 10:30:41 -07:00
2017-03-16 16:55:58 -07:00
2017-06-19 11:03:50 -04:00
2017-06-09 09:27:32 -06:00
2017-06-19 11:03:50 -04:00
2017-03-07 11:30:16 -05:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2017-03-07 13:28:33 -05:00
2016-06-10 15:15:44 -04:00
2017-05-17 09:44:53 -04:00
2017-03-07 13:28:31 -05:00
2016-12-16 00:13:41 +02:00
2017-05-05 14:40:13 -04:00
2017-03-07 13:28:31 -05:00
2017-03-07 13:28:31 -05:00
2017-05-14 21:54:33 -04:00
2017-03-07 13:28:31 -05:00
2017-08-23 12:49:55 -06:00
2017-06-19 11:03:49 -04:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2015-11-04 21:19:53 -08:00
2016-01-08 20:03:05 -05:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2017-06-19 11:03:50 -04:00
2017-06-19 11:03:51 -04:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2016-11-01 09:43:26 -06:00
2017-08-23 12:49:55 -06:00
2016-02-22 22:34:42 -05:00
2016-02-22 22:34:42 -05:00
2017-08-23 12:49:55 -06:00
2017-07-25 14:54:20 -04:00
2016-08-07 14:41:02 -06:00
2017-02-17 00:54:09 -05:00
2017-06-18 14:20:04 -06:00
2017-06-09 09:27:32 -06:00
2016-02-22 22:34:42 -05:00
2017-05-31 10:50:23 -04:00
2016-01-08 20:03:05 -05:00
2017-08-23 12:49:55 -06:00
2017-05-08 17:15:12 -07:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2016-06-10 15:15:44 -04:00
2017-07-26 15:55:44 -04:00
2017-06-09 09:27:32 -06:00
2017-05-15 15:09:49 -04:00
2016-07-20 12:43:35 -04:00
2017-08-23 12:49:55 -06:00
2017-07-26 15:55:44 -04:00
2017-03-16 09:37:31 -04:00
2017-08-23 12:49:55 -06:00
2017-04-24 15:37:04 -04:00
2017-06-09 09:27:32 -06:00
2017-08-23 12:49:55 -06:00
2017-07-26 15:55:43 -04:00
2017-08-23 12:49:55 -06:00
2017-06-19 11:05:20 -04:00
2017-08-23 12:49:55 -06:00
2017-04-27 17:08:44 -04:00
2017-08-23 12:49:55 -06:00
2017-06-19 11:05:20 -04:00
2017-08-23 12:49:55 -06:00
2017-02-13 09:17:50 -08:00
2017-06-19 11:05:20 -04:00
2017-05-21 20:37:09 -07:00
2017-03-16 16:55:50 -07:00
2017-08-28 13:00:44 -06:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2017-07-21 12:47:20 -07:00
2017-08-23 12:49:55 -06:00
2017-04-27 14:01:16 -07:00
2017-08-28 13:00:44 -06:00
2017-05-11 22:11:11 -07:00
2017-08-23 12:49:55 -06:00
2017-08-23 12:49:55 -06:00
2017-05-03 10:31:20 -07:00
2017-08-23 12:49:55 -06:00
2017-04-11 10:13:02 -07:00