Page MenuHomeFreeBSD

if_tuntap: make SIOCIFDESTROY interruptible
Needs ReviewPublic

Authored by kevans on Apr 20 2023, 10:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 13, 5:31 PM
Unknown Object (File)
Mon, Nov 11, 7:21 PM
Unknown Object (File)
Sun, Nov 10, 10:10 PM
Unknown Object (File)
Sun, Nov 10, 10:05 PM
Unknown Object (File)
Sun, Nov 10, 9:51 PM
Unknown Object (File)
Sun, Nov 10, 2:10 AM
Unknown Object (File)
Sun, Nov 10, 1:21 AM
Unknown Object (File)
Sun, Nov 10, 12:34 AM

Details

Reviewers
None
Group Reviewers
network
Summary

There's no good justification to permanently hang a thread until the
tunnel can be destroyed. Make it interruptible so that the admin can
^C it and remedy the situation if something erroneously has the tunnel
open, rather than forcing them to open another shell to resolve it.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 56418
Build 53306: arc lint + arc unit

Event Timeline

markj added inline comments.
sys/net/if_tuntap.c
632–633

Hmm, shouldn't this be a while loop?

637

I would just use cv_wait() here so that the locking protocol is consistent. Then we can unconditionally unlock below instead of having the tp->tun_busy == 0 || may_intr check.

Shall we firstly signal the application that the tuntap device is going to be shutdown and destroyed and secondly poll the status of tun_busy ?

Or just return EBUSY if applications can decline interface destroying ?

(Sorry, I just realized I forgot about this review entirely)

In D39740#905088, @zlei wrote:

Shall we firstly signal the application that the tuntap device is going to be shutdown and destroyed and secondly poll the status of tun_busy ?

I'm not sure what that would look like, exactly.

Or just return EBUSY if applications can decline interface destroying ?

I think that's probably fine (in the may_intr case, since the !may_intr case is usually "we're evacuaating the vnet"), but I'd prefer to do as a follow-up so that we're not changing the semantics that much in a minor release (where-as, we can kinda fix the current situation a little bit)

Use a loop, set error before (it'll either get clobbered or remain untouched),
and just consistently keep it locked leaving the loop.