SUMMARY: Re: Oddball files preventing removal of nfs-mounted directories

From: Chris W Knox (Chris.W.Knox@aexp.com)
Date: Mon Jun 12 2000 - 10:16:25 CDT


Thanks to all who answered. I received many replies to this query, most of
which were generally correct. The most informative explanation came from
Birger.Wathne%getronics.no which appears below.

The users swore up and down that all processes holding the file open were
dead, but we know better.

---------------------- Forwarded by Chris W Knox on 06/12/2000 08:01 AM
---------------------------
From: Birger.Wathne%getronics.no on 06/10/2000 08:00 AM
To: Chris W Knox@AMEX
cc:
Subject: Re: Oddball files preventing removal of nfs-mounted
directories

This happens because of the Unix file semantics.

When a file gets deleted while it is held open by a process, it only gets
unlinked
from the directory tree but the file blocks are not deallocated until the last
process closes it.

Fine and dandy, but processes running on NFS mounted file systems should
preferrably see the same file system semantics as processes running on local
file
systems. What happens if a file gets deleted on the server? NFS is stateless,
so
the server doesn't know that a process has this file open on a client. The file
just gets deleted and deallocated. If a request comes in from a client to
write to
a file that has been deleted, the NFS daemon quickly creates a .nfs* file and
uses
this file as a replacement.

In short, somewhere on your network some machine has this file system mounted,
and
some process is writing to a file in that directory. Happy hunting...

Birger

--
                Birger Wathne
                Senior Systems Consultant
   Getronics    Birger.Wathne@Ark.no
     Norge
                Getronics Norge AS     (+47) 55 98 28 00 (switchboard)
                Postboks 154 Kokstad   (+47) 55 98 28 06 (direct)
                N-5863 Bergen, Norway  (+47) 55 98 28 80 (fax)

============================================================ My original question:

I have users complaining that they can't remove directories. The message that they get is

$rm -r docs rm: Unable to remove directory dir/helocs/calcs: File exists rm: Unable to remove directory dir/helocs: File exists rm: Unable to remove directory dir: File exists

The only thing in the directory is a file with a name like .nfsA1B, to wit:

drwxrwxr-x 3 user group 512 Jun 9 14:55 . drwxrwxr-x 3 user group 512 May 31 15:58 .. -rwxrwxr-x 1 user group 241 May 18 05:32 .nfsB8C

The user can delete the file, but another one like it pops up. I could remove it as root on the server, but that's hardly the right answer. What to do, what to do.



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:09 CDT