From nobody@FreeBSD.org  Mon Dec 10 04:20:34 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 2EDEE37B41D
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 10 Dec 2001 04:20:34 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id fBACKYT15330;
	Mon, 10 Dec 2001 04:20:34 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200112101220.fBACKYT15330@freefall.freebsd.org>
Date: Mon, 10 Dec 2001 04:20:34 -0800 (PST)
From: Mark Hannon <markhannon@optushome.com.au>
To: freebsd-gnats-submit@FreeBSD.org
Subject: NFS directory removal problems manifested in portupgrade
X-Send-Pr-Version: www-1.0

>Number:         32668
>Category:       ports
>Synopsis:       ports-mgmt/portupgrade: NFS directory removal problems manifested in portupgrade
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sem
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 10 04:30:01 PST 2001
>Closed-Date:    Tue Jun 17 10:26:43 UTC 2008
>Last-Modified:  Tue Jun 17 10:26:43 UTC 2008
>Originator:     Mark Hannon
>Release:        4.4-STABLE (two versions ... see below)
>Organization:
>Environment:
NFS client: 
tbird:~# uname -a
FreeBSD tbird.home.lan 4.4-STABLE FreeBSD 4.4-STABLE #0: Sat Dec  1 22:39:55 EST 2001     mark@tbird.home.lan:/tmp  i386

NFS server:
doorway:~> uname -a
FreeBSD doorway.home.lan 4.4-STABLE FreeBSD 4.4-STABLE #0: Sun Oct  7 12:59:46 EST 2001     mark@tbird-fe1.home.lan:/site/arch/FreeBSD-i386/usr/src/sys/compile/DOORWAY_IPFW  i386

>Description:
I run a NFS distributed /usr/{compat,local,X11R6} as well as /var/db/pkg
and /etc/X11 small network.  Recently I have noticed some problems when
running portupgrade from the NFS client.  Upgrades, package removals
etc. all fail with an error message when attempting to delete the old
pkg database directory.  The error message is directory not empty.

Running the command from the NFS server works fine.

A ktrace looks ok.  The interesting bits are below:

 65158 rm       RET   break 0
 65158 rm       CALL  lstat(0x807d140,0x807d160)
 65158 rm       NAMI  "/var/db/pkg/rmoldmail-0.1.0"
 65158 rm       RET   lstat 0
 65158 rm       CALL  open(0x806bed0,0,0)
 65158 rm       NAMI  "."
 65158 rm       RET   open 3
 65158 rm       CALL  fchdir(0x3)
 65158 rm       RET   fchdir 0
 65158 rm       CALL  access(0x807c000,0x2)
 65158 rm       NAMI  "/var/db/pkg/rmoldmail-0.1.0"
 65158 rm       RET   access 0
 65158 rm       CALL  stat(0x807c000,0xbfbff368)
 65158 rm       NAMI  "/var/db/pkg/rmoldmail-0.1.0"
 65158 rm       RET   stat 0
 65158 rm       CALL  open(0x807c000,0x4,0)
 65158 rm       NAMI  "/var/db/pkg/rmoldmail-0.1.0"
 65158 rm       RET   open 6
 65158 rm       CALL  fstat(0x6,0xbfbff368)
 65158 rm       RET   fstat 0
 65158 rm       CALL  fcntl(0x6,0x2,0x1)
 65158 rm       RET   fcntl 0
 65158 rm       CALL  __sysctl(0xbfbff220,0x2,0x80772f0,0xbfbff21c,0,0)
 65158 rm       RET   __sysctl 0
 65158 rm       CALL  fstatfs(0x6,0xbfbff268)
 65158 rm       RET   fstatfs 0
 65158 rm       CALL  break(0x807f000)
 65158 rm       RET   break 0
 65158 rm       CALL  fstat(0x6,0xbfbff368)
 65158 rm       RET   fstat 0
 65158 rm       CALL  fchdir(0x6)
 65158 rm       RET   fchdir 0
 65158 rm       CALL  getdirentries(0x6,0x807e000,0x1000,0x807a0b4)
 65158 rm       RET   getdirentries 512/0x200
 65158 rm       CALL  lstat(0x807d240,0x807d24c)
 65158 rm       NAMI  "+CONTENTS"
 65158 rm       RET   lstat 0
 65158 rm       CALL  lstat(0x807d340,0x807d348)
 65158 rm       NAMI  "+DESC"
 65158 rm       RET   lstat 0
 65158 rm       CALL  lstat(0x807d440,0x807d44c)
 65158 rm       NAMI  "+COMMENT"
 65158 rm       RET   lstat 0
 65158 rm       CALL  getdirentries(0x6,0x807e000,0x1000,0x807a0b4)
 65158 rm       RET   getdirentries 0
 65158 rm       CALL  lseek(0x6,0,0,0,0)
 65158 rm       RET   lseek 0
 65158 rm       CALL  close(0x6)
 65158 rm       RET   close 0
 65158 rm       CALL  access(0x807d240,0x2)
 65158 rm       NAMI  "+CONTENTS"
 65158 rm       RET   access 0
 65158 rm       CALL  unlink(0x807d240)
 65158 rm       NAMI  "+CONTENTS"
 65158 rm       RET   unlink 0
 65158 rm       CALL  access(0x807d340,0x2)
 65158 rm       NAMI  "+DESC"
 65158 rm       RET   access 0
 65158 rm       CALL  unlink(0x807d340)
 65158 rm       NAMI  "+DESC"
 65158 rm       RET   unlink 0
 65158 rm       CALL  access(0x807d440,0x2)
 65158 rm       NAMI  "+COMMENT"
 65158 rm       RET   access 0
 65158 rm       CALL  unlink(0x807d440)
 65158 rm       NAMI  "+COMMENT"
 65158 rm       RET   unlink 0
 65158 rm       CALL  fchdir(0x3)
 65158 rm       RET   fchdir 0
 65158 rm       CALL  rmdir(0x807c000)
 65158 rm       NAMI  "/var/db/pkg/rmoldmail-0.1.0"
 65158 rm       RET   rmdir -1 errno 66 Directory not empty
 65158 rm       CALL  write(0x2,0xbfbfed80,0x4)
 65158 rm       GIO   fd 2 wrote 4 bytes
       "rm: "
 65158 rm       RET   write 4
 65158 rm       CALL  write(0x2,0xbfbfeda0,0x1b)
 65158 rm       GIO   fd 2 wrote 27 bytes
       "/var/db/pkg/rmoldmail-0.1.0"

My reading of the above says that all of the unlinks succeed but
the directory is not empty anyway ... perhaps a timing bug with 
one of those .nfs files ??

The NFS server has had softupdates both enabled and disabled with no
change in behaviour

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->peter 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Sun Dec 30 04:23:19 PST 2001 
Responsible-Changed-Why:  
Peter, could you put your NFS hat on and take a look at this one? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32668 

From: Mike Heffner <mheffner@novacoxmail.com>
To: freebsd-gnats-submit@freebsd.org
Cc: FreeBSD-bugs <freebsd-bugs@freebsd.org>
Subject: Re: kern/32668: NFS directory removal problems manifested in portupgrade
Date: Mon, 07 Jan 2002 16:45:41 -0500 (EST)

 For audit trail:
 
 Please see PR 33647 for followup.
 
 Mike
 
 -- 
   Mike Heffner     <mheffner@[acm.]vt.edu>
   Fredericksburg, VA   <mikeh@FreeBSD.org>
 
Responsible-Changed-From-To: peter->freebsd-bugs 
Responsible-Changed-By: peter 
Responsible-Changed-When: Tue Dec 13 04:12:32 UTC 2005 
Responsible-Changed-Why:  
NFS is working as designed, as mentioned in the other PR.  Maybe portupgrade 
can be modified to work on an NFS-mounted /var/db/pkg. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32668 
Responsible-Changed-From-To: freebsd-bugs->cel 
Responsible-Changed-By: cel 
Responsible-Changed-When: Fri May 12 18:36:02 UTC 2006 
Responsible-Changed-Why:  
Will review portsupgrade and see if I can drive the ports maintainers to 
do something about this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32668 
Responsible-Changed-From-To: cel->freebsd-ports-bugs 
Responsible-Changed-By: remko 
Responsible-Changed-When: Sun Dec 31 10:56:10 UTC 2006 
Responsible-Changed-Why:  
In the ticket there is a mentioning about portupgrade not being able to 
work very well with nfs mounted environments. Assign this to the ports 
team that handles portupgrade (amongst others). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32668 
Responsible-Changed-From-To: freebsd-ports-bugs->sem 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Fri Jan 12 14:19:32 UTC 2007 
Responsible-Changed-Why:  
sem@ now maintains portupgrade 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32668 
State-Changed-From-To: open->closed 
State-Changed-By: sem 
State-Changed-When: Tue Jun 17 10:26:42 UTC 2008 
State-Changed-Why:  
Looks like this long standing bug as fixed in HEAD. The problem was in 
unclosed +CONTENTS file. (Thanks to kris@) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32668 
>Unformatted:
