OS-6441: netstack_find_by_stackid() drops-and-reacquires


Issue Type:Bug
Priority:4 - Normal
Created at:2017-11-06T01:23:49.358Z
Updated at:2017-12-11T20:09:15.751Z


Created by:Dan McDonald
Reported by:Dan McDonald
Assigned to:Dan McDonald


Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2017-12-08T17:04:03.706Z)

Fix Versions

2017-12-21 Honey Bee (Release Date: 2017-12-21)


The netstack_find_by_stackid() function drops the netstack's lock, and lets netstack_hold() reacquire it.  We really should just reference-hold while we're holding the netstack lock.  So factor out the reference-bump into netstack_hold_locked() and have netstack_find_by_stackid() do the reference hold.


Comment by Dan McDonald
Created at 2017-11-06T01:24:14.907Z

Discovered while learning more about OS-5423.

Comment by Dan McDonald
Created at 2017-12-06T23:02:52.264Z

There are other related problems in netstack.c, where the NSF_{UNINIT,CLOSING} flags are checked without holding the mutex, and then reference-holding.  The flags COULD be set between checking and holding.  This bugfix will address these as well.

Comment by Dan McDonald
Created at 2017-12-06T23:04:21.216Z

OS-6501 tracks the LX issues related to this.

Comment by Dan McDonald
Created at 2017-12-08T16:17:11.814Z

Tested by:

1.) Verifying that the five external entry points:

get entered during testing.

2.) Zone bringup & teardown (single zone deployment for now).

3.) Using "echo '::netstack' | mdb -k" to see netstacks torn down and created during #2 loops.

4.) Done under DEBUG, and no ::findleaks output found on "reboot -d" dump.

Comment by Jira Bot
Created at 2017-12-08T17:04:11.593Z

illumos-joyent commit 4ff06ef3de4da3187a6599932808d6e674052fad (branch master, by Dan McDonald)

OS-6441 netstack_find_by_stackid() drops-and-reacquires
Reviewed by: Jason King <jbk@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Ryan Zezeski <rpz@joyent.com>
Approved by: Ryan Zezeski <rpz@joyent.com>

Comment by Jira Bot
Created at 2017-12-11T20:09:15.751Z

illumos-joyent commit a5637b14d727171abf87f2f4b7601781b6c8d43c (branch master, by Dan McDonald)

OS-6501 LX netstack-hold code needs to correspond to OS-6441 fixes
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>