From: Christoph Hellwig <hch@lst.de>
To: "David S. Miller" <davem@redhat.com>
Cc: trond.myklebust@fys.uio.no, torvalds@transmeta.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] remove useless MOD_{INC,DEC}_USE_COUNT from sunrpc
Date: Sun, 4 May 2003 23:00:11 +0200 [thread overview]
Message-ID: <20030504230010.A12753@lst.de> (raw)
In-Reply-To: <1052075166.27465.12.camel@rth.ninka.net>; from davem@redhat.com on Sun, May 04, 2003 at 12:06:06PM -0700
On Sun, May 04, 2003 at 12:06:06PM -0700, David S. Miller wrote:
> Well, what if this hangs? Unless the user specifies
> "--wait" to 2.5.x's rmmod, the user absolutely does not
> expect this behavior.
>
> Rather, so that the "--wait" is respected, something one level
> up ought to be doing try_module_get().
Oh well, what about something like the following?
--- 1.25/net/sunrpc/sched.c Thu May 1 12:52:23 2003
+++ edited/net/sunrpc/sched.c Sun May 4 21:25:21 2003
@@ -952,6 +952,14 @@
wait_queue_head_t *assassin = (wait_queue_head_t*) ptr;
int rounds = 0;
+ /*
+ * We are locked into memory by beeing used by another module,
+ * but the refcount might be 0 neverless so we can't use
+ * __module_get().
+ */
+ if (!try_module_get(THIS_MODULE))
+ return -EBUSY;
+
lock_kernel();
/*
* Let our maker know we're running ...
@@ -994,6 +1002,7 @@
dprintk("RPC: rpciod exiting\n");
unlock_kernel();
+ module_put(THIS_MODULE);
return 0;
}
@@ -1042,6 +1051,11 @@
if (error < 0) {
printk(KERN_WARNING "rpciod_up: create thread failed, error=%d\n", error);
rpciod_users--;
+ goto out;
+ }
+ if (!rpciod_pid) {
+ rpciod_users--;
+ error = -EBUSY;
goto out;
}
down(&rpciod_running);
next prev parent reply other threads:[~2003-05-04 20:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-04 17:14 [PATCH] remove useless MOD_{INC,DEC}_USE_COUNT from sunrpc Christoph Hellwig
2003-05-04 17:37 ` Trond Myklebust
2003-05-04 18:36 ` Christoph Hellwig
2003-05-04 18:46 ` Trond Myklebust
2003-05-04 18:53 ` Christoph Hellwig
2003-05-04 19:00 ` Trond Myklebust
2003-05-04 19:06 ` David S. Miller
2003-05-04 19:56 ` Trond Myklebust
2003-05-04 20:14 ` Trond Myklebust
2003-05-04 21:00 ` Christoph Hellwig [this message]
2003-05-04 20:15 ` David S. Miller
2003-05-05 8:29 ` Christoph Hellwig
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=20030504230010.A12753@lst.de \
--to=hch@lst.de \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
--cc=trond.myklebust@fys.uio.no \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.