[Devel] [PATCH RHEL7 COMMIT] fuse kio: Place more pcs_cs_link::cs under rcu dereference
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Jun 20 11:47:15 MSK 2018
The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.50.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.50.14
------>
commit 4c0cb5bc35454a207a167235243f4b34d082e1f8
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Wed Jun 20 11:47:15 2018 +0300
fuse kio: Place more pcs_cs_link::cs under rcu dereference
Just a sanity cleanup.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Reviewed-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
fs/fuse/kio/pcs/pcs_cs.c | 4 +++-
fs/fuse/kio/pcs/pcs_map.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index 7445d87de32e..17125527b1f2 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -594,8 +594,10 @@ static int may_reroute(struct pcs_cs_list *csl, PCS_NODE_ID_T cs_id)
int legit = 0;
for (i = csl->nsrv - 1; i >= 0; i--) {
- struct pcs_cs *cs = csl->cs[i].cslink.cs;
+ struct pcs_cs *cs;
+ cs = rcu_dereference_protected(csl->cs[i].cslink.cs,
+ atomic_read(&csl->refcnt) > 0);
if (cs->id.val == cs_id.val)
continue;
if (test_bit(CS_SF_FAILED, &cs->state))
diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index e2b02f9863ac..35833169f2f7 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -1339,7 +1339,8 @@ static void map_read_error(struct pcs_int_request *ireq)
if (csl == NULL || csl->map == NULL || (csl->map->state & PCS_MAP_ERROR))
return;
- cs = csl->cs[ireq->iochunk.cs_index].cslink.cs;
+ cs = rcu_dereference_protected(csl->cs[ireq->iochunk.cs_index].cslink.cs,
+ atomic_read(&csl->refcnt) > 0);
if (ireq->flags & IREQ_F_MAPPED) {
cs_blacklist_unlocked(cs, ireq->error.value, "error on directly mapped CS");
More information about the Devel
mailing list