[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio_pcs: fix update cs state after receiving new map

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 13 18:27:59 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.20.2.vz7.73.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.20.2.vz7.73.4
------>
commit a3d9b592d9e7bc174aee634fd8389d06779bfc10
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Tue Nov 13 18:27:58 2018 +0300

    fs/fuse kio_pcs: fix update cs state after receiving new map
    
    Update cs state was implemented incorrectly, when new state comes, we need not
    only to set new CS_SF_* states, but also to clean out the outdated ones. This
    patch fixes it.
    
    https://pmc.acronis.com/browse/VSTOR-17413
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_map.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 86b610fe746d..459645417462 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -1002,17 +1002,29 @@ struct pcs_cs_list* cslist_alloc( struct pcs_cs_set *css, struct pcs_cs_info *re
 		if (cs->mds_flags & CS_FL_LOCAL) {
 			set_bit(CS_SF_LOCAL, &cs->state);
 			cs_list->flags |= CSL_FL_HAS_LOCAL;
-		}
+		} else if (test_bit(CS_SF_LOCAL, &cs->state))
+			clear_bit(CS_SF_LOCAL, &cs->state);
+
 		if (cs->mds_flags & CS_FL_LOCAL_SOCK)
 			set_bit(CS_SF_LOCAL_SOCK, &cs->state);
+		else if (test_bit(CS_SF_LOCAL_SOCK, &cs->state))
+			clear_bit(CS_SF_LOCAL_SOCK, &cs->state);
+
 		if (cs->mds_flags & CS_FL_INACTIVE) {
 			set_bit(CS_SF_INACTIVE, &cs->state);
 			cs_blacklist(cs, PCS_ERR_NET_ABORT, "mds hint");
-		}
+		} else if (test_bit(CS_SF_INACTIVE, &cs->state))
+			clear_bit(CS_SF_INACTIVE, &cs->state);
+
 		if (cs->mds_flags & CS_FL_REPLICATING)
 			set_bit(CS_SF_REPLICATING, &cs->state);
+		else if (test_bit(CS_SF_REPLICATING, &cs->state))
+			clear_bit(CS_SF_REPLICATING, &cs->state);
+
 		if (cs->mds_flags & CS_FL_FAILED)
 			set_bit(CS_SF_FAILED, &cs->state);
+		else if (test_bit(CS_SF_FAILED, &cs->state))
+			clear_bit(CS_SF_FAILED, &cs->state);
 
 		list_add(&cslink->link, &cs->map_list);
 		cs->nmaps++;



More information about the Devel mailing list