netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Max Krasnyansky <maxk@qualcomm.com>
Cc: "David S. Miller" <davem@redhat.com>, netdev@oss.sgi.com
Subject: Re: [PATCH] tun driver use private linked list.
Date: Tue, 12 Aug 2003 10:02:59 -0700	[thread overview]
Message-ID: <20030812100259.7d557bf3.shemminger@osdl.org> (raw)
In-Reply-To: <5.1.0.14.2.20030812092213.08dc6ea0@unixmail.qualcomm.com>

On Tue, 12 Aug 2003 09:48:50 -0700
Max Krasnyansky <maxk@qualcomm.com> wrote:

> At 01:18 AM 8/9/2003, David S. Miller wrote:
> >On Fri, 8 Aug 2003 11:34:04 -0700
> >Stephen Hemminger <shemminger@osdl.org> wrote:
> >
> >> Less grotty version, applies over earlier patch.
> >>       - keep a private list.  
> >>       - fix debug format strings.
> >>       - drop the name entry in the private data structure since it already
> >>         has a pointer to netdev that has name.
> >
> >Applied, thanks for following up on this Stephen.
> 
> Folks,
> 
> Sorry for jumping in late. 
> I didn't implement cleanup logic in module_exit() because TUN module is not supposed 
> to be unloaded if it has network devices, _even if those devices are down_.
> TUN registers net device only when user application asks for it.
>         fd = open("/dev/net/tun") -> ioctl(fd, CREATE_TUN_DEV) -> read(fd)/write(fd);
> Net device must not be destroyed while fd is open.
> 
> So instead of cleaning up in tun_module_exit() we should fix misc driver to do refcounting 
> for misc devices so that we could bump ref count for tun driver when application creates
> net device.

Not necessary to change anything.  If user process has /dev/net/tun open, then the owner
field in the fops causes the module reference count to correctly increment.  Verified this
and it works.  The issue is that it is possible to create TUN devices with TUN_PERSIST
set and they have to be cleaned up upon. module_exit.

The patch works as expected.

  reply	other threads:[~2003-08-12 17:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200308051630.28552.bellucda@tiscali.it>
     [not found] ` <20030805090647.691daa7e.shemminger@osdl.org>
     [not found]   ` <200308051910.55823.bellucda@tiscali.it>
2003-08-07 22:45     ` [PATCH] tun driver not cleaning up on module remove Stephen Hemminger
2003-08-07 22:59       ` David S. Miller
2003-08-08 18:34         ` [PATCH] tun driver use private linked list Stephen Hemminger
2003-08-09  8:18           ` David S. Miller
2003-08-12 16:48             ` Max Krasnyansky
2003-08-12 17:02               ` Stephen Hemminger [this message]
2003-10-09 18:45                 ` Max Krasnyansky
2003-10-09 19:59                   ` Stephen Hemminger
2003-10-21 15:55                     ` Max Krasnyansky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030812100259.7d557bf3.shemminger@osdl.org \
    --to=shemminger@osdl.org \
    --cc=davem@redhat.com \
    --cc=maxk@qualcomm.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).