Commit bc14d864 authored by Petr Vandrovec's avatar Petr Vandrovec Committed by Linus Torvalds

[PATCH] ipx use of cli/sti

This removes cli/sti from SPX registration code in IPX.  I decided to
use normal rw_semaphore instead of net_family_{write,read}_{lock,unlock}
used in net/socket.c.

I left SPX code itself alone: I do not use it and last time I checked it
it was very unreliable reliable transport.
parent 06868c17
...@@ -145,6 +145,7 @@ static struct datalink_proto *pSNAP_datalink; ...@@ -145,6 +145,7 @@ static struct datalink_proto *pSNAP_datalink;
static struct proto_ops ipx_dgram_ops; static struct proto_ops ipx_dgram_ops;
static struct net_proto_family *spx_family_ops; static struct net_proto_family *spx_family_ops;
static DECLARE_RWSEM(spx_family_ops_lock);
static ipx_route *ipx_routes; static ipx_route *ipx_routes;
static rwlock_t ipx_routes_lock = RW_LOCK_UNLOCKED; static rwlock_t ipx_routes_lock = RW_LOCK_UNLOCKED;
...@@ -1929,10 +1930,13 @@ static int ipx_create(struct socket *sock, int protocol) ...@@ -1929,10 +1930,13 @@ static int ipx_create(struct socket *sock, int protocol)
* From this point on SPX sockets are handled * From this point on SPX sockets are handled
* by af_spx.c and the methods replaced. * by af_spx.c and the methods replaced.
*/ */
down_read(&spx_family_ops_lock);
if (spx_family_ops) { if (spx_family_ops) {
ret = spx_family_ops->create(sock, protocol); ret = spx_family_ops->create(sock, protocol);
up_read(&spx_family_ops_lock);
goto decmod; goto decmod;
} }
up_read(&spx_family_ops_lock);
/* Fall through if SPX is not loaded */ /* Fall through if SPX is not loaded */
case SOCK_STREAM: /* Allow higher levels to piggyback */ case SOCK_STREAM: /* Allow higher levels to piggyback */
default: default:
...@@ -2463,20 +2467,27 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -2463,20 +2467,27 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
int ipx_register_spx(struct proto_ops **p, struct net_proto_family *spx) int ipx_register_spx(struct proto_ops **p, struct net_proto_family *spx)
{ {
if (spx_family_ops) int err;
return -EBUSY;
cli(); err = -EBUSY;
down_write(&spx_family_ops_lock);
if (!spx_family_ops) {
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
*p = &ipx_dgram_ops; *p = &ipx_dgram_ops;
spx_family_ops = spx; spx_family_ops = spx;
sti(); }
up_write(&spx_family_ops_lock);
return 0; return 0;
} }
int ipx_unregister_spx(void) int ipx_unregister_spx(void)
{ {
down_write(&spx_family_ops_lock);
if (spx_family_ops) {
spx_family_ops = NULL; spx_family_ops = NULL;
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
}
up_write(&spx_family_ops_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment