Thread (10 messages) 10 messages, 5 authors, 2014-10-02

Re: [PATCH net-next v6 2/2] bonding: Simplify the xmit function for modes that use xmit_hash

From: Cong Wang <hidden>
Date: 2014-10-02 04:40:41

On Wed, Oct 1, 2014 at 1:38 AM, Mahesh Bandewar [off-list ref] wrote:
+int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave)
+{
+       struct slave *slave;
+       struct list_head *iter;
+       struct bond_up_slave *new_arr, *old_arr;
+       int slaves_in_agg;
+       int agg_id = 0;
+       int ret = 0;
+
+#ifdef CONFIG_LOCKDEP
+       WARN_ON(lockdep_is_held(&bond->mode_lock));
+#endif

I think you can use lockdep_is_held().
+
+       new_arr = kzalloc(offsetof(struct bond_up_slave, arr[bond->slave_cnt]),
+                         GFP_KERNEL);
+       if (!new_arr) {
+               ret = -ENOMEM;
+               pr_err("Failed to build slave-array.\n");
+               goto out;
+       }

No need to print an error message for OOM, it is already noisy. :)

+       if (BOND_MODE(bond) == BOND_MODE_8023AD) {
+               struct ad_info ad_info;
+
+               if (bond_3ad_get_active_agg_info(bond, &ad_info)) {
+                       pr_debug("bond_3ad_get_active_agg_info failed\n");

I suspect how useful this debug info is since your patch is almost ready
to merge.
+                       kfree_rcu(new_arr, rcu);
+                       /* No active aggragator means its not safe to use
s/its/it's/
+                        * the previous array.
+                        */
+                       old_arr = rtnl_dereference(bond->slave_arr);
+                       if (old_arr) {
+                               RCU_INIT_POINTER(bond->slave_arr, NULL);
+                               kfree_rcu(old_arr, rcu);
+                       }
+                       goto out;
+               }
+               slaves_in_agg = ad_info.ports;
+               agg_id = ad_info.aggregator_id;
+       }


Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help