From: Tang Junhui <redacted>
In btree_flush_write(), two places need to take a locker to
avoid races:
Firstly, we need take rcu read locker to protect the bucket_hash
traverse, since hlist_for_each_entry_rcu() must be called under
the protection of rcu read locker.
Secondly, we need take b->write_lock locker to protect journal
of the btree node, otherwise, the btree node may have been
written, and the journal have been assign to NULL.
Signed-off-by: Tang Junhui <redacted>
---
drivers/md/bcache/journal.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
On 24/01/2018 2:54 PM, tang.junhui@zte.com.cn wrote:
quoted hunk
From: Tang Junhui <redacted>
In btree_flush_write(), two places need to take a locker to
avoid races:
Firstly, we need take rcu read locker to protect the bucket_hash
traverse, since hlist_for_each_entry_rcu() must be called under
the protection of rcu read locker.
Secondly, we need take b->write_lock locker to protect journal
of the btree node, otherwise, the btree node may have been
written, and the journal have been assign to NULL.
Signed-off-by: Tang Junhui <redacted>
---
drivers/md/bcache/journal.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Hi Junhui,
Do you run into some real problem ? The patch looks good to me at first
glance, but I need time to dig it more before I provide my response.
Thanks.
Coly Li
From: Nikolay Borisov <hidden> Date: 2018-01-24 10:30:53
On 24.01.2018 08:54, tang.junhui@zte.com.cn wrote:
quoted hunk
From: Tang Junhui <redacted>
In btree_flush_write(), two places need to take a locker to
avoid races:
Firstly, we need take rcu read locker to protect the bucket_hash
traverse, since hlist_for_each_entry_rcu() must be called under
the protection of rcu read locker.
Secondly, we need take b->write_lock locker to protect journal
of the btree node, otherwise, the btree node may have been
written, and the journal have been assign to NULL.
Signed-off-by: Tang Junhui <redacted>
---
drivers/md/bcache/journal.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)