Messages in this thread Patch in this message | | | From | Elvis Pfützenreuter <> | Subject | Fwd: PATCH: Linux locks when you try to mount volume and NFS server is down | Date | Mon, 13 Mar 2000 12:46:01 -0300 |
| |
If you do
/etc/rc.d/init.d/nfs stop /etc/rc.d/init.d/nfs restart
and then some computer tries to mount a volume of the server, it locks. Tracking down the problem, we could see that it happens if all the following conditions are true:
- NFS server daemons [nfsd] are down; - rpc.mountd is up; - you run exportfs -a or exportfs -r; and of course - if you try to mount some volume.
When a client tries to mount a NFS volume, it provokes the following function calls in knfsd:
exp_rootfh -> fh_put -> add_to_fhcache -> find_fhe
find_fhe must return a file handle that already lies in the cache, OR an empty space so add_to_fhcache can put the file handle in the cache. But, if NFS server is down, the cache size becomes zero, and find_fhe does not return any file handle nor an empty cache entry.
So add_to_fhcache tries to invalidade some old file handle (it will fail because cache size is zero anyway) and will call find_fhe again, that will fail, so it will try to invalidate something again and... we have an infinite loop that locks the server.
The following patch makes add_to_fhcache test if nfsd_nservers is zero; if it is, it will not loop because it knows the allocation will be unsucessfull anyway. (It applies for kernel 2.2.14)
--- nfsfh.c.orig Tue Jan 4 16:12:23 2000 +++ nfsfh.c Fri Mar 10 13:23:04 2000 @@ -676,6 +676,15 @@ return 1; } + /* if nfsd_server is zero, NFSD_MAXFH will be zero too, so + * find_fhe() will NEVER find the file handle NOR an empty space, + * and expire_slot will not be able to expire any file handle, + * because NFSD_MAXFH is zero ... */ + + if (nfsd_nservers <= 0) { + return 0; + } + expire_slot(cache); goto repeat; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |