[Devel] [PATCH RHEL7 COMMIT] fuse kio: Port "ignore uninitialized CS addresses" commit

Konstantin Khorenko khorenko at virtuozzo.com
Tue Oct 16 17:29:25 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.8
------>
commit 60180ee2b6d36727637d356f4d3cc5e5c0c81320
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Oct 16 17:29:23 2018 +0300

    fuse kio: Port "ignore uninitialized CS addresses" commit
    
    Port commit 601296c30c18eceebd3ca72d2210696370af6ec6 from userspace
    
    >    [PCS] libpcs_client: ignore uninitialized CS addresses
    >
    >    Now MDS can return uninitialized CS address.
    >    This happens when a CS is dead and MDS switched to new master,
    >    which has no information about CS location.
    >
    >    Related to, but does not change anything essential for VSTOR-3415.
    >
    >    Affects: #VSTOR-3415
    >
    >    Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
    
    BUG_ON() replaced with WARN_ON_ONCE() to not crash kernel
    on protocol failure.
    
    Also, function made static.
    
    https://pmc.acronis.com/browse/VSTOR-16083
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_cs.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index 56ab3adb36db..8ed1c8f91d99 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -173,7 +173,7 @@ static inline int netaddr_cmp(PCS_NET_ADDR_T const *addr1, PCS_NET_ADDR_T const
 	return memcmp(addr1->address, addr2->address, sz);
 }
 
-int pcs_netaddr_cmp(PCS_NET_ADDR_T const *addr1, PCS_NET_ADDR_T const *addr2)
+static int pcs_netaddr_cmp(PCS_NET_ADDR_T const *addr1, PCS_NET_ADDR_T const *addr2)
 {
 	return netaddr_cmp(addr1, addr2, 0);
 }
@@ -190,16 +190,25 @@ struct pcs_cs *pcs_cs_find_create(struct pcs_cs_set *csset, PCS_NODE_ID_T *id, P
 		 * After current connect fails, reconnect will be done to new address
 		 */
 		if (addr) {
-			if (pcs_netaddr_cmp(&cs->addr, addr)) {
-				cs->addr = *addr;
-				cs->addr_serno++;
-
-				FUSE_KTRACE(cc_from_csset(csset)->fc, "Port change CS" NODE_FMT " seq=%d", NODE_ARGS(*id), cs->addr_serno);
-				pcs_rpc_set_address(cs->rpc, addr);
-
-				if (!(flags & CS_FL_INACTIVE)) {
-					pcs_map_notify_addr_change(cs);
-					cs_whitelist(cs, "addr update");
+			if (addr->type != PCS_ADDRTYPE_NONE) {
+				if (pcs_netaddr_cmp(&cs->addr, addr)) {
+					cs->addr = *addr;
+					cs->addr_serno++;
+
+					FUSE_KTRACE(cc_from_csset(csset)->fc,
+						    "Port change CS" NODE_FMT " seq=%d",
+						    NODE_ARGS(*id), cs->addr_serno);
+					pcs_rpc_set_address(cs->rpc, addr);
+
+					if (!(flags & CS_FL_INACTIVE)) {
+						pcs_map_notify_addr_change(cs);
+						cs_whitelist(cs, "addr update");
+					}
+				}
+			} else {
+				if (WARN_ON_ONCE(!(flags & CS_FL_INACTIVE))) {
+					spin_unlock(&cs->lock);
+					return NULL;
 				}
 			}
 		}



More information about the Devel mailing list