Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jul 1999 14:10:52 +0200 (CEST)
From:      Jan Conrad <conrad@th.physik.uni-bonn.de>
To:        freebsd-hackers@freebsd.org
Cc:        Sheldon Hearn <sheldonh@uunet.co.za>, Jan Conrad <conrad@th.physik.uni-bonn.de>
Subject:   NFS problems due to getcwd/realpath 
Message-ID:  <Pine.BSF.4.10.9907151329040.9501-100000@merlin.th.physik.uni-bonn.de>

next in thread | raw e-mail | index | archive | help
Hi everybody,

after wondering for two years why FreeBSD (2.2.x ... 3.2) might lock up
when an NFS server is down, I think I have found one reason for that (see
kern/12609 - I now know it doesn't belong to kern - sorry).

It is the implementation of getcwd (src/lib/libc/gen/getcwd.c). When
examining the parent dir of a mounted filesystem, getcwd lstats every
directory entry prior to the mountpoint to find out the name of the
mountpoint (but it would only need the inodes's device to do a rough 
check....).

If one of the prior entries point to another NFS mountpoint and that one
is down, getcwd will wait till the mountpoint is up again.... This of
course applies to all routines which use getcwd, e.g. realpath.


This is especially funny since mountd calls realpath (from the RPC
handler!!!!) to check mount points, so when to machines mount dirs from
each other, they can lock up, e.g. at boottime (see kern/12609...)


I don't fully understand whether the problem is still present in 3.x,
since getcwd may call __getcwd to do the job, but as I understand from the
sources, __getcwd may fail and then you're back with the problem.


Anyhow, how can this be resolved (except for symlinking all mountpoints)?
Must getcwd really do an lstat to find out an inodes device?? Is there no
other syscall to do that? (I mean: this information must be present
somewhere, without going over the net, right?) Unfortunately I don't
now such a syscall.

In my opinion getcwd should be implemented differently, but maybe some
people have a differen opinion on that (And I am not sure how to do that 
properly).

Any suggestions?

best regards
	Jan

-- 
Physikalisches Institut der Universitaet Bonn
Nussallee 12
D-53115 Bonn
GERMANY



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9907151329040.9501-100000>