lkml.org 
[lkml]   [2003]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH/RFC] New module refcounting for net_proto_family
At 03:03 AM 1/21/2003 -0800, David S. Miller wrote:
> From: Max Krasnyansky <maxk@qualcomm.com>
> Date: Sun, 19 Jan 2003 19:22:44 -0800 (PST)
>
> The only reason to do module refcounting in sk is if protocol
> changes default callbacks (i.e. sk->data_ready, etc).
>
>What about the reference to skb->sk? Are you sure there are
>no cases where:
>
>1) skb->sk will be non-NULL
>2) default callbacks are used

In that case we don't care whether the module is still loaded or not.
Here is the list of sk callbacks
void (*state_change)(struct sock *sk);
void (*data_ready)(struct sock *sk, int bytes);
void (*write_space)(struct sock *sk);
void (*error_report)(struct sock *sk);
int (*backlog_rcv) (struct sock *sk, struct sk_buff *skb);
void (*destruct)(struct sock *sk);
Net core doesn't make any other calls into the protocol module.

In any case if protocol module wants, for some reason, to be around until sk is destroyed
it can call sk_set_owner() right after sk_alloc(), even if it uses default callbacks.

While looking at the net families that we support I realized that there is one more reason
why protocol may have to call sk_set_owner(). Is if protocol uses private slab cache for its
sks. Otherwise cache will be destroyed during module unloading but sk may still be alive.

Here is a little summary about families that I looked at:
Netlink - Global sk cache, replaces sk->destruct() callback.
Must call sk_set_owner()

Unix - Private sk cache, replaces sk->destruct() and sk->write_space() callbacks
Must call sk_set_owner()

IPv4/6 - Private cache, non-default callbacks.
Must call sk_set_owner() (cannot be a module, so we don't really care)

IPX - Global cache, default callbacks.

ATM - Global cache, default callbacks.

IRDA - Global cache, default callbacks.

Bluetooth - Private cache (don't really need it, will change to global), non-default callbacks
Must call sk_set_owner()

AX25 - Global cache, non-default sk->destroy()
Must call sk_set_owner()

Rose - Global cache, default callbacks.

DecNet - Private cache, non-default callbacks.
Must call sk_set_owner()

LLC - Global cache, default callbacks.

Max

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.091 / U:8.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site