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

Submitted by Konstantin Khorenko on Nov. 13, 2018, 3:27 p.m.

Details

Message ID 201811131527.wADFRwXl019271@finist-ce7.sw.ru
State New
Series "fs/fuse kio_pcs: fix update cs state after receiving new map"
Headers show

Commit Message

Konstantin Khorenko Nov. 13, 2018, 3:27 p.m.
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@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@virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_map.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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++;