Re: [PATCH] remove useless MOD_{INC,DEC}_USE_COUNT from sunrpc

Christoph Hellwig (hch@lst.de)
Sun, 4 May 2003 20:53:06 +0200


On Sun, May 04, 2003 at 08:46:47PM +0200, Trond Myklebust wrote:
> > What do you thing about something like the following to wait on
> > the thread in module_exit()?
>
> I don't understand. That is still an interruptible wait, so how would
> that help?

It doesn't :) Sorry, the code should use wait_even(), the
_interruptible was a pasto..

> What is wrong with just assuming that the rpciod() thread might need
> to run independently of the calling module for a short period of time
> in order to kill/clean up the pending tasks?

That's fine and the patch doesn't change anything about the assumption.
If just changes how to make sure the sunrpc module can't be unloaded
during that period. Previously you incremented the usecount and now
we're waiting for the thread to finish in module_exit().

--- 1.10/include/linux/sunrpc/sched.h Sun Jan 12 16:40:13 2003
+++ edited/include/linux/sunrpc/sched.h Sun May 4 19:08:09 2003
@@ -188,6 +188,7 @@
int rpciod_up(void);
void rpciod_down(void);
void rpciod_wake_up(void);
+void wait_on_rpciod(void);
#ifdef RPC_DEBUG
void rpc_show_tasks(void);
#endif
--- 1.24/net/sunrpc/sched.c Thu Mar 27 12:42:11 2003
+++ edited/net/sunrpc/sched.c Sun May 4 19:07:42 2003
@@ -1097,6 +1092,12 @@
spin_unlock_irqrestore(&current->sighand->siglock, flags);
out:
up(&rpciod_sema);
+}
+
+void
+wait_on_rpciod(void)
+{
+ wait_event(&rpciod_killer, !rpciod_pid);
}

#ifdef RPC_DEBUG
-
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/