You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2015/06/03 01:41:21 UTC

[2/3] mesos git commit: Fixed a bug in qdisc search function.

Fixed a bug in qdisc search function.

Review: https://reviews.apache.org/r/34957


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c9fb7ebf
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c9fb7ebf
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c9fb7ebf

Branch: refs/heads/master
Commit: c9fb7ebf57aeb9f09b9e1daa8b14f97665f1bba5
Parents: c831758
Author: Jie Yu <yu...@gmail.com>
Authored: Tue Jun 2 14:54:34 2015 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Jun 2 16:40:12 2015 -0700

----------------------------------------------------------------------
 src/linux/routing/filter/internal.hpp   |  6 +++++-
 src/linux/routing/queueing/internal.hpp | 10 ++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c9fb7ebf/src/linux/routing/filter/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/filter/internal.hpp b/src/linux/routing/filter/internal.hpp
index 10f0bea..8a48102 100644
--- a/src/linux/routing/filter/internal.hpp
+++ b/src/linux/routing/filter/internal.hpp
@@ -517,7 +517,11 @@ inline Try<std::vector<Netlink<struct rtnl_cls>>> getClses(
 
   for (struct nl_object* o = nl_cache_get_first(cache.get());
        o != NULL; o = nl_cache_get_next(o)) {
-    nl_object_get(o); // Increment the reference counter.
+    // NOTE: We increment the reference counter here because 'cache'
+    // will be freed when this function finishes and we want this
+    // object's life to be longer than this function.
+    nl_object_get(o);
+
     results.push_back(Netlink<struct rtnl_cls>((struct rtnl_cls*) o));
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/c9fb7ebf/src/linux/routing/queueing/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/queueing/internal.hpp b/src/linux/routing/queueing/internal.hpp
index d0c81ab..3713f6a 100644
--- a/src/linux/routing/queueing/internal.hpp
+++ b/src/linux/routing/queueing/internal.hpp
@@ -139,8 +139,14 @@ inline Try<std::vector<Netlink<struct rtnl_qdisc>>> getQdiscs(
 
   for (struct nl_object* o = nl_cache_get_first(cache.get());
        o != NULL; o = nl_cache_get_next(o)) {
-    nl_object_get(o); // Increment the reference counter.
-    results.push_back(Netlink<struct rtnl_qdisc>((struct rtnl_qdisc*) o));
+    if (rtnl_tc_get_ifindex(TC_CAST(o)) == rtnl_link_get_ifindex(link.get())) {
+      // NOTE: We increment the reference counter here because 'cache'
+      // will be freed when this function finishes and we want this
+      // object's life to be longer than this function.
+      nl_object_get(o);
+
+      results.push_back(Netlink<struct rtnl_qdisc>((struct rtnl_qdisc*) o));
+    }
   }
 
   return results;