bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NFS directory not really "changed during execution of find"


From: Martin Buchholz
Subject: NFS directory not really "changed during execution of find"
Date: Sat, 20 Nov 2004 20:40:00 -0800

On Solaris at least, the NFS automounting system mostly transparently
mounts filesystems as they are accessed, and apparently unmounts them
after they have been unused for 5 minutes.

$ find make -name foobar
find: make changed during execution of find (old device number 81032649, new 
device number 80744598, filesystem type is nfs) [ref 629]

Therefore an unused filesystem will generate a "changed during
execution of find" error every time find crosses such a recently
unused mount point during execution.  Rerunning find immediately
afterwards will succeed.

This makes `find' unusable on Solaris machines with NFS automounters.
It must be fixed.

Here is an illustration of the change of device numbers over time:

$ perl -e 'use File::stat; while (1) {print "@{[stat(\"./make\")->dev]} 
@{[stat(\"./make/.\")->dev]} \n"; sleep(int(rand(600)));}'
81032648 80744590 
80744590 80744590 
80744590 80744590 
81032648 80744592 
80744592 80744592 
81032648 80744595 
80744595 80744595 
80744595 80744595 
81032648 80744596 
80744596 80744596 
80744596 80744596 
81032648 80744599 
80744599 80744599 

(As you can see from the above, the "dev" field is incremented every
time the directory is auto-re-mounted)

(The directory `./make' is an automatically mounted NFS mount point)

$ find --version
GNU find version 4.2.5
$ uname -a
SunOS suttles 5.9 Generic_112233-05 sun4u sparc SUNW,Sun-Blade-1000

So the current ws_sanity_check in find.c is too aggressive.  At the
very least it needs to take the possibility of NFS filesystems into
account.  Or perhaps you could explicitly exclude file system mount
points from the sanity check?

Here is a kludgy, not ready-for-prime-time patch that seems to works
for me, against find-4.2.5.

--- find.c~     2004-11-14 16:10:20.000000000 -0800
+++ find.c      2004-11-20 20:25:10.452682000 -0800
@@ -544,6 +544,7 @@
     {
       what = specific_dirname(what);
       fstype = filesystem_type(thing_to_stat, ".", newinfo);
+      if (strcmp(fstype,"nfs") == 0) return;
       
       error (1, 0,
             _("%s%s changed during execution of %s (old device number %ld, new 
device number %ld, filesystem type is %s) [ref %ld]"),
@@ -561,6 +562,7 @@
     {
       what = specific_dirname(what);
       fstype = filesystem_type(thing_to_stat, ".", newinfo);
+      if (strcmp(fstype,"nfs") == 0) return;
       
       error (1, 0,
             _("%s%s changed during execution of %s (old inode number %ld, new 
inode number %ld, filesystem type is %s) [ref %ld]"),

Martin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]