From: Petr Vandrovec <vandrove@vc.cvut.cz>
To: torvalds@transmeta.com
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: [PATCH] ipx use of cli/sti
Date: Mon, 22 Jul 2002 20:23:07 +0200 [thread overview]
Message-ID: <20020722182307.GA5932@vana.vc.cvut.cz> (raw)
Hi Linus,
patch below 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.
Thanks,
Petr Vandrovec
--- linux-2.5.27-c683/net/ipx/af_ipx.c.orig 2002-07-22 15:32:51.000000000 +0200
+++ linux-2.5.27-c683/net/ipx/af_ipx.c 2002-07-22 20:10:39.000000000 +0200
@@ -145,6 +145,7 @@
static struct proto_ops ipx_dgram_ops;
static struct net_proto_family *spx_family_ops;
+static DECLARE_RWSEM(spx_family_ops_lock);
static ipx_route *ipx_routes;
static rwlock_t ipx_routes_lock = RW_LOCK_UNLOCKED;
@@ -1929,10 +1930,13 @@
* From this point on SPX sockets are handled
* by af_spx.c and the methods replaced.
*/
+ down_read(&spx_family_ops_lock);
if (spx_family_ops) {
ret = spx_family_ops->create(sock, protocol);
+ up_read(&spx_family_ops_lock);
goto decmod;
}
+ up_read(&spx_family_ops_lock);
/* Fall through if SPX is not loaded */
case SOCK_STREAM: /* Allow higher levels to piggyback */
default:
@@ -2463,20 +2467,27 @@
int ipx_register_spx(struct proto_ops **p, struct net_proto_family *spx)
{
- if (spx_family_ops)
- return -EBUSY;
- cli();
- MOD_INC_USE_COUNT;
- *p = &ipx_dgram_ops;
- spx_family_ops = spx;
- sti();
+ int err;
+
+ err = -EBUSY;
+ down_write(&spx_family_ops_lock);
+ if (!spx_family_ops) {
+ MOD_INC_USE_COUNT;
+ *p = &ipx_dgram_ops;
+ spx_family_ops = spx;
+ }
+ up_write(&spx_family_ops_lock);
return 0;
}
int ipx_unregister_spx(void)
{
- spx_family_ops = NULL;
- MOD_DEC_USE_COUNT;
+ down_write(&spx_family_ops_lock);
+ if (spx_family_ops) {
+ spx_family_ops = NULL;
+ MOD_DEC_USE_COUNT;
+ }
+ up_write(&spx_family_ops_lock);
return 0;
}
reply other threads:[~2002-07-22 18:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20020722182307.GA5932@vana.vc.cvut.cz \
--to=vandrove@vc.cvut.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@transmeta.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
all inboxes | Powered by JetHome®