From root@nl.demon.net  Wed Oct 25 10:59:35 2000
Return-Path: <root@nl.demon.net>
Received: from post.mail.nl.demon.net (post-10.mail.nl.demon.net [194.159.73.20])
	by hub.freebsd.org (Postfix) with ESMTP id BB42837B4D7
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 25 Oct 2000 10:59:34 -0700 (PDT)
Received: from [194.159.73.45] (helo=ftp.server.nl.demon.net)
	by post.mail.nl.demon.net with smtp (Exim 3.14 #2)
	id 13oUpp-00067p-00
	for FreeBSD-gnats-submit@freebsd.org; Wed, 25 Oct 2000 17:59:33 +0000
Received: by ftp.server.nl.demon.net with local id 13oUpp-0001q9-00
	for multiple recipients; Wed, 25 Oct 2000 17:59:33 +0000
Message-Id: <E13oUpp-0001q9-00@ftp.server.nl.demon.net>
Date: Wed, 25 Oct 2000 17:59:33 +0000
From: pdp@nl.demon.net
Sender: root@nl.demon.net
To: FreeBSD-gnats-submit@freebsd.org
Cc: pdp@nl.demon.net
Subject: getcwd() fails on recently-modified NFS-mounted dirs
X-Send-Pr-Version: 3.2

>Number:         22291
>Category:       kern
>Synopsis:       [nfs] getcwd(3) fails on recently-modified NFS-mounted dirs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 25 11:00:00 PDT 2000
>Closed-Date:    
>Last-Modified:  Mon Sep 29 03:37:46 UTC 2008
>Originator:     Phil Pennock
>Release:        FreeBSD 4.1.1-STABLE i386
>Organization:
Thus PLC (Demon NL)
>Environment:
FreeBSD FreeBSD 4.1.1-STABLE i386 (src upgraded 2000-09-29)
NFS mount from Network Appliance Netapp
ftp-netapp1:/ftp on /public/pub (nfs, nodev, nosuid)
>Description:
We have an FTP server, mounting publically-available filesystem from a
NetApp.  The chroot() point is to local disk, with NFS mounted on /pub
within that environment.  With an open FTP connection, the (customised)
server experiences a realpath() failure (EACCESS) if the cwd of the
connection is modified (file added or deleted) via normal login.  This
resolves itself either with the passing of time, or by causing a stat of
the directory which isn't stat(".") (CDUP, CD back; or "ls /the/cwd").
The call to realpath() fails in getcwd() (found via gdb).

Using ktrace, we see:
  6506 ftpd     CALL  __getcwd(0xbfbff2ec,0x400)
  6506 ftpd     RET   __getcwd -1 errno 20 Not a directory

This is a directory; it has just been modified recently.

ktrace's of an FTP LIST command when it works and when it fails because
the dir has been modified available upon request.  A "diff -u" is
informative.
>How-To-Repeat:
Via Description above.  ktraces, diffs, available upon request.  Access
to server code can be arranged if desired, but the above shows it to not
be a problem with our code.
>Fix:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: johan 
State-Changed-When: Thu Jul 15 11:16:14 GMT 2004 
State-Changed-Why:  
In May 2003 alot of stuff was changed in realpath(3) in STABLE. 
Can you possibly try with FreeBSD-4.9 of 4.10 and see if your 
problem still persist? 

Please send a mail to bug-followup@freebsd.org with the subject  
of this mail intact with any info you might have. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=22291 
State-Changed-From-To: feedback->closed 
State-Changed-By: kris 
State-Changed-When: Sat Jul 30 00:39:32 GMT 2005 
State-Changed-Why:  
Feedback timeout 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22291 
State-Changed-From-To: closed->open 
State-Changed-By: linimon 
State-Changed-When: Sun Jul 31 19:07:54 GMT 2005 
State-Changed-Why:  
Submitter has noted that others claim the problem still persists on 4.11 
and 5.4 without these patches. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22291 
Responsible-Changed-From-To: freebsd-bugs->cel 
Responsible-Changed-By: cel 
Responsible-Changed-When: Fri May 12 18:15:46 UTC 2006 
Responsible-Changed-Why:  
I'll take this.  Does the submitter have a reproducer, or at least 
have information about whether this still occurs with 6.1? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22291 
Responsible-Changed-From-To: cel->freebsd-bugs 
Responsible-Changed-By: cel 
Responsible-Changed-When: Mon Mar 12 15:26:42 UTC 2007 
Responsible-Changed-Why:  
Back to the public pool. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22291 

From: Martin Birgmeier <martin@email.aon.at>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/22291: [nfs] getcwd() fails on recently-modified NFS-mounted dirs
Date: Sat, 2 Feb 2008 10:03:23 +0100 (CET)

 I have what seems a very similar problem when running a build of
 openoffice-2-devel with WRKDIRPREFIX set to an NFS-mounted directory:
 Intermittently, the build will fail with an error message like the
 following:
 
 -----------------------------------------------------------------------
 Making: ../unxfbsdi.pro/slo/config.obj
 dmake:  Error: -- Internal Error: Error when calling getcwd()!
 dmake:  Error: -- Internal Error: Error when calling getcwd()!
 ---* tg_merge.mk *---
 
 ERROR: Error 65280 occurred while making /.../gandalf/d/14.1/tmp/ports-7/editors/openoffice.org-2-devel/work/SRC680_m243/starmath/source
 dmake:  Error code 1, while making 'build_instsetoo_native'
 ---*  *---
 *** Error code 255
 
 Stop in /.../gandalf/d/12s1e/SRC/FreeBSD/HEAD/ports/editors/openoffice.org-2-devel.
 -----------------------------------------------------------------------
 
 The NFS client machine (the one running the build) is running
 RELENG_7_0 as of January 23, the server machine is running
 RELENG_6_3_0_RELEASE. The same has happened when the server was
 still running RELENG_6_2_0_RELEASE.
 
 Please note that the email address given above is not valid as I want
 to avoid receiving spam. Simply add to the PR and I'll follow it via
 the web interface.
>Unformatted:
