On Apr 11 Chris Boot wrote: > +static void session_check_for_reset(struct sbp_session *sess) > +{ > + bool card_valid = false; > + > + spin_lock_bh(&sess->lock); > + > + if (sess->card) { > + spin_lock_irq(&sess->card->lock); > + card_valid = (sess->card->local_node != NULL); > + spin_unlock_irq(&sess->card->lock); > + > + if (!card_valid) { > + fw_card_put(sess->card); > + sess->card = NULL; > + } > + } > + > + if (!card_valid || (sess->generation != sess->card->generation)) { > + pr_info("Waiting for reconnect from node: %016llx\n", > + sess->guid); > + > + sess->node_id = -1; > + sess->reconnect_expires = get_jiffies_64() + > + ((sess->reconnect_hold + 1) * HZ); > + } > + > + spin_unlock_bh(&sess->lock); > +} The card->local_node != NULL test by itself is atomic, it does not benefit from being wrapped by card->lock acquisition. Well, OK, the lock effectively forces the compiler to determine the value of card_valid only once. If the lock weren't there I guess the compiler might feel entitled to reload card->local_node in the second !card_valid test. But even if you lose ACCESS_ONCE behavior by removing the card->lock acquisition, I can't see how that could be detrimental relative to the current code. I am wondering on the other hand if there isn't actually a dependency between this local_node test and something else, e.g. the generation test. I.e. might the locking be incomplete? Not sure about that. I think I rather want to look at that again when I received the code through mainline. BTW "card_valid" sounds rather generic; maybe call it "topology_valid"? Either way, it can turn valid or invalid any time when firewire-core gets to handle a self-ID-complete event. -- Stefan Richter -=====-===-- -=-- -===- http://arcgraph.de/sr/ -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html