[PATCH rfc 0/3] Fix a possible infinite loop when iterating over a discovery tree

Sagi Grimberg sagi at grimberg.me
Fri Aug 14 16:42:36 EDT 2020


Today we can easily get to an infinite loop if the discovery tree itself
contains a loop (via referrals). So if we have a discovery controller
A referring to discovery controller B, and in turn B will also refer
to A we will never finish the discovery loop.

The reason is that we blindly connect and discover to every discovery
log page entry that we find (i.e. referral to another discovery controller).
However, we are not able to detect loops, and we just continue indefinitely.

Fix this by tracking every controller we are connecting to, and then
if we see a discovery log entry that we already saw while iterating the
discovery tree recursion (or should I say graph in this case).

Sagi Grimberg (3):
  nvme: add fabrics discovery controller default port number
  fabrics: move connect_args extraction to a dedicated routine
  fabrics: fix infinite loop is discovery recursion contains a loop

 common.h     |   3 ++
 fabrics.c    | 114 ++++++++++++++++++++++++++++++++++++++++++++-------
 linux/nvme.h |   1 +
 3 files changed, 103 insertions(+), 15 deletions(-)

-- 
2.25.1




More information about the Linux-nvme mailing list