cvs commit: src/sys/netgraph ng_tty.c

Gleb Smirnoff glebius at FreeBSD.org
Wed Jan 12 23:43:13 PST 2005


glebius     2005-01-13 07:43:12 UTC

  FreeBSD src repository

  Modified files:
    sys/netgraph         ng_tty.c 
  Log:
  Locking and cleanup of tty netgraph node. Tty stack is Giant-locked,
  so we need to acquire Giant in netgraph methods, so that we don't
  race with line discipline methods. Remove NET_NEEDS_GIANT.
  
  - Packets coming into node from netgraph are queued in ifqueue
    attached to node private data.
  - Mutex in struct ifqueue is used to lock not only the queue, but
    the whole private data, and tp->t_lsc field.
  - tp->t_lsc pointer is used to indicate whether line discipline is
    attached to netgraph or not.
  - Use FLG_DIE flag to indicate that node may be destroyed.
    (This protection doesn't work, and it didn't before. Must be redesigned.)
  - Increment ngt_unit atomically, removing mutex.
  - Acquire Giant, when executing ngt_start() from netgraph context.
  - Acquire Giant, when {,de}registering line discipline.
  - Uncomment forcing queue mode on peers hook, since this is reasonable.
  - Force queue mode on our hook, to avoid acquiring Giant when coming from
    network stack. We may already hold some mutexes at this point.
  
  Cleanups:
  - Use callout_pending() instead of our own flag.
  - Remove spl(9) calls. Now we can use return() instead of ERROUT().
  
  style(9):
  - Sort includes.
  - Sparse initializer for struct linesw.
  - Remove some empty lines, sort declarations.
  
  Reviewed by:    julian, phk
  MFC after:      1 month
  
  Revision  Changes    Path
  1.34      +182 -176  src/sys/netgraph/ng_tty.c


More information about the cvs-src mailing list