@@ -1134,7 +1134,7 @@ struct lnet {
struct lnet_lnd *ln_lnds[NUM_LNDS];
/* test protocol compatibility flags */
- int ln_testprotocompat;
+ unsigned long ln_testprotocompat;
/*
* 0 - load the NIs from the mod params
@@ -484,16 +484,11 @@
if (the_lnet.ln_testprotocompat) {
/* single-shot proto check */
- lnet_net_lock(LNET_LOCK_EX);
- if (the_lnet.ln_testprotocompat & 1) {
+ if (test_and_clear_bit(0, &the_lnet.ln_testprotocompat))
hmv->version_major++; /* just different! */
- the_lnet.ln_testprotocompat &= ~1;
- }
- if (the_lnet.ln_testprotocompat & 2) {
+
+ if (test_and_clear_bit(1, &the_lnet.ln_testprotocompat))
hmv->magic = LNET_PROTO_MAGIC;
- the_lnet.ln_testprotocompat &= ~2;
- }
- lnet_net_unlock(LNET_LOCK_EX);
}
hdr->src_nid = cpu_to_le64(hello->kshm_src_nid);
@@ -541,12 +536,8 @@
if (the_lnet.ln_testprotocompat) {
/* single-shot proto check */
- lnet_net_lock(LNET_LOCK_EX);
- if (the_lnet.ln_testprotocompat & 1) {
+ if (test_and_clear_bit(0, &the_lnet.ln_testprotocompat))
hello->kshm_version++; /* just different! */
- the_lnet.ln_testprotocompat &= ~1;
- }
- lnet_net_unlock(LNET_LOCK_EX);
}
rc = lnet_sock_write(sock, hello, offsetof(struct ksock_hello_msg, kshm_ips),
@@ -174,16 +174,11 @@
if (the_lnet.ln_testprotocompat) {
/* single-shot proto check */
- lnet_net_lock(LNET_LOCK_EX);
- if (the_lnet.ln_testprotocompat & 4) {
+ if (test_and_clear_bit(2, &the_lnet.ln_testprotocompat))
cr.acr_version++;
- the_lnet.ln_testprotocompat &= ~4;
- }
- if (the_lnet.ln_testprotocompat & 8) {
+
+ if (test_and_clear_bit(3, &the_lnet.ln_testprotocompat))
cr.acr_magic = LNET_PROTO_MAGIC;
- the_lnet.ln_testprotocompat &= ~8;
- }
- lnet_net_unlock(LNET_LOCK_EX);
}
rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout);
@@ -3842,9 +3842,7 @@ u32 lnet_get_dlc_seq_locked(void)
return 0;
case IOC_LIBCFS_TESTPROTOCOMPAT:
- lnet_net_lock(LNET_LOCK_EX);
the_lnet.ln_testprotocompat = data->ioc_flags;
- lnet_net_unlock(LNET_LOCK_EX);
return 0;
case IOC_LIBCFS_LNET_FAULT: