Messages in this thread Patch in this message | | | Subject | self cleaning nfsiod's | Date | Fri, 19 Apr 1996 01:50:21 -0500 (CDT) | From | (Mike Castle) |
| |
Is there anything obviously wrong with the following? It seems fairly stable for me, under 1.3.91. Been sitting here mounting and unmounting nfs and watching all those happy little nfsiod's die by themselves.
--- linux/fs/nfs/inode.c.orig Fri Apr 19 00:58:31 1996 +++ linux/fs/nfs/inode.c Fri Apr 19 01:32:07 1996 @@ -322,6 +322,8 @@ nfs_read_super, "nfs", 0, NULL }; +static pid_t nfsiod_pid[4]; + /* * Start up an nfsiod process. This is an awful hack, because when running * as a module, we will keep insmod's memory. Besides, the current->comm @@ -330,7 +332,7 @@ * other things) forks biod's. * Alternatively, we might want to have the idle task spawn biod's on demand. */ -static int run_nfsiod(void *dummy) +static int run_nfsiod(void *my_pid) { int ret; @@ -339,22 +341,21 @@ syscall_count++; #endif - MOD_INC_USE_COUNT; current->session = 1; current->pgrp = 1; sprintf(current->comm, "nfsiod"); ret = nfsiod(); - MOD_DEC_USE_COUNT; + *(pid_t*)my_pid = -1; return ret; } int init_nfs_fs(void) { /* Fork four biod's */ - kernel_thread(run_nfsiod, NULL, 0); - kernel_thread(run_nfsiod, NULL, 0); - kernel_thread(run_nfsiod, NULL, 0); - kernel_thread(run_nfsiod, NULL, 0); + nfsiod_pid[0] = kernel_thread(run_nfsiod, &nfsiod_pid[0], 0); + nfsiod_pid[1] = kernel_thread(run_nfsiod, &nfsiod_pid[1], 0); + nfsiod_pid[2] = kernel_thread(run_nfsiod, &nfsiod_pid[2], 0); + nfsiod_pid[3] = kernel_thread(run_nfsiod, &nfsiod_pid[3], 0); return register_filesystem(&nfs_fs_type); } @@ -370,6 +371,23 @@ void cleanup_module(void) { + int i; + int done; + + for (i = 0; i < 4; i++) { + if (nfsiod_pid[i] != -1) { + kill_proc(nfsiod_pid[i], SIGKILL, 1); + } + } + + do { + done = 1; + for (i = 0; i < 4; i++) { + done &= (nfsiod_pid[i] == -1); + } + schedule(); + } while (!done); + unregister_filesystem(&nfs_fs_type); nfs_kfree_cache(); }
-- Mike Castle .-=NEXUS=-. Life is like a clock: You can work constantly mcastle@cs.umr.edu and be right all the time, or not work at all mcastle@umr.edu and be right at least twice a day. -- mrc We are all of us living in the shadow of Manhattan. -- Watchmen
| |