Re: shutdown node VS disconnect all hooks

From: Julian Elischer (julian_at_elischer.org)
Date: 05/28/04

  • Next message: Harti Brandt: "Re: shutdown node VS disconnect all hooks"
    Date: Thu, 27 May 2004 16:33:28 -0700 (PDT)
    To: Gleb Smirnoff <glebius@cell.sick.ru>
    
    

    On Fri, 28 May 2004, Gleb Smirnoff wrote:

    > Hi collegues,
    >
    > I'm again with the issue about node destruction process. If you
    > already forgot the problem, I'll remind you: in RELENG_4 node cuts down
    > all its hooks itself from shutdown method, while in HEAD it is done
    > in ng_rmnode() _before_ calling shutdown method. This breaks
    > ng_tee behavior, and as I have noted, having hooks connected in
    > shutdown method may be useful sometimes.
    >
    > OK, If we destroy node in such a sequence
    >
    > 1. nodes shutdown method
    > 2. ng_destroy_hook() on all hooks
    > 3. ng_flush_input_queue()
    >
    > in some cases we may have node be lost when its shutdown method calls
    > NG_NODE_UNREF. Ok, I have tried to put one more ref on node just before
    > calling its shutdown method. Seems like it works! However we may catch
    > panic in nodes which do not expect that ng_type_disconnect() may
    > be called after ng_type_shutdown(). Since RELENG_4 the following nodes
    > had been changed to don't expect this sequence:
    >
    > ng_socket
    > ng_atmllc
    > ng_bridge
    > ng_eiface
    > ng_etf
    > ng_ether
    > ng_frame_relay
    > ng_gif
    > ng_gif_demux
    > ng_iface
    > ng_l2tp
    > ng_lmi
    > ng_mppc
    > ng_one2many
    > ng_ppp
    > ng_pppoe
    > ng_pptpgre
    > ng_rfc1490
    > ng_source
    > ng_sppp
    > ng_tty
    > ng_vjc
    > ng_vlan
    >
    > They all FREE priv in shutdown method, but use it in disconnect method.
    > The problem can be solved by inserting ng_cutlinks() into beginning of
    > shutdown method for each of above nodes like it is done in RELENG_4.
    > Ok, we need to edit more than 20 nodes to get back ng_tees behavior. I'm
    > sure you don't like it :)

    there are other reasons why this can not work.
    That is why it was changed from 4.x.

    >
    > So, what about adding one more netgraph method into struct ng_type, say
    > ng_preshutdown_t? This method is called first in ng_rmnode(), and then
    > current shutdown sequence is followed. We will set it to NULL in all existing
    > nodes, and create a method in ng_tee, which calls ng_bypass(). Future
    > implementations may use this method to send "goodbye" messages down hooks when
    > shutting down.

    That sounds like a much better solution. Node shutdown is done in 2
    parts just as node connection is done in 2 parts.

    > And this will be a POLA-friendly solution - we will not lose functionality
    > of RELENG_4 (which mpd relies on), and we will not break nodes which
    > rely on current shutdown sequence.
    >
    > What's your opinion? If it is positive - I'll send patches.
    >

    That is a very workable solution.

    ng_warn_shutdown()
     ng_cutlinks()
    ng_shutdown()

    > --
    > Totus tuus, Glebius.
    > GLEBIUS-RIPN GLEB-RIPE
    >

    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


  • Next message: Harti Brandt: "Re: shutdown node VS disconnect all hooks"

    Relevant Pages

    • shutdown node VS disconnect all hooks
      ... all its hooks itself from shutdown method, while in HEAD it is done ... in ng_rmnode_before_ calling shutdown method. ... current shutdown sequence is followed. ... of RELENG_4, and we will not break nodes which ...
      (freebsd-net)
    • Re: Loud "pop" coming from hard drive on reboot
      ... sequence but things get somewhat ugly because shutdown sequence is driven from sd->shutdown. ... We'll have to snoop both sync and shutdown commands and check whether the system is shutting down. ... This seems pretty easy to deal with at command issue. ...
      (Linux-Kernel)
    • Re: Loud "pop" coming from hard drive on reboot
      ... sequence but things get somewhat ugly because shutdown sequence is ... We'll have to snoop both sync and shutdown ... This seems pretty easy to deal with at command issue. ...
      (Linux-Kernel)
    • Re: Loud "pop" coming from hard drive on reboot
      ... sequence but things get somewhat ugly because shutdown sequence is driven from sd->shutdown. ... We'll have to snoop both sync and shutdown commands and check whether the system is shutting down. ... This seems pretty easy to deal with at command issue. ...
      (Linux-Kernel)
    • Kernel 2.60 i810 Framebuffer.
      ... well except when I shutdown from while in iceWM. ... console on ttyand then shutdown, the shutdown sequence is shown. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)