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);
-
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/