OSDN Git Service

nexthop: Restart nexthop dump based on last dumped nexthop identifier
authorIdo Schimmel <idosch@nvidia.com>
Fri, 16 Apr 2021 15:55:34 +0000 (18:55 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 Apr 2021 22:20:34 +0000 (15:20 -0700)
commit9e46fb656fdb40baec33a8942743d81a40f30fd3
treed4d7a4b77a2504818624ee1abfcd07a6cf2f4691
parent56aa7b21a5a7d30484ab5833641cb172356225f1
nexthop: Restart nexthop dump based on last dumped nexthop identifier

Currently, a multi-part nexthop dump is restarted based on the number of
nexthops that have been dumped so far. This can result in a lot of
nexthops not being dumped when nexthops are simultaneously deleted:

 # ip nexthop | wc -l
 65536
 # ip nexthop flush
 Dump was interrupted and may be inconsistent.
 Flushed 36040 nexthops
 # ip nexthop | wc -l
 29496

Instead, restart the dump based on the nexthop identifier (fixed number)
of the last successfully dumped nexthop:

 # ip nexthop | wc -l
 65536
 # ip nexthop flush
 Dump was interrupted and may be inconsistent.
 Flushed 65536 nexthops
 # ip nexthop | wc -l
 0

Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
Tested-by: Maksym Yaremchuk <maksymy@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/nexthop.c