Solaris 8 NFS client problem with link and rename

Solaris 8 NFS client problem with link and rename

Post by Daniel Forres » Wed, 27 Jun 2001 04:12:11



I have found what I believe to be a bug in the Solaris 8 NFS client.
After an upgrade from Solaris 5.6, one of our programs began failing.
I have been able to reproduce the failure with the following script:

#!/bin/sh
HOST=`hostname`
FILE=foobar
#
# Remove any old files
#
rm -f $FILE                     # unlink("$FILE")
rm -f $FILE.busy                # unlink("$FILE.busy")
#
# This is part of an exclusive open routine.
# The "ln" should only succeed if "$FILE.busy" does not already exist.
#
rm -f $HOST.$$.xopn             # unlink("$HOST.$$.xopn")
exec 4>$HOST.$$.xopn         # open("$HOST.$$.xopn", ...)
ln $HOST.$$.xopn $FILE.busy     # link("$HOST.$$.xopn", "$FILE.busy")
rm -f $HOST.$$.xopn             # unlink("$HOST.$$.xopn")
#
# Doing the move before closing the file descriptor fails.
# Doing the move after closing the file descriptor works.
#
date >&4
mv $FILE.busy $FILE             # before close fails, after close works
exec 4>&-                        # close(4)

The result should be the file "foobar" with the output of the "date"
command.  When run on a local file-system or under Solaris 5.6, this
is the result.  When run under Solaris 8 on an NFS mounted file-system
the file "foobar" does not exist, however a file named ".nfsXXXX" does
exist and contains the output of the "date" command.  Note that if the
last two lines of the script are swapped, then the result is correct.
Also, if the "mv" command is omitted then the file "foobar.busy" is
created correctly in all cases.

I have tried both Solaris (5.6 and 8) and Linux NFS clients and both
Solaris (5.6) and Linux NFS servers.  The failure only occurs for the
Solaris 8 NFS client, and regardless of the type of NFS server.

Has anyone seen this before?  Is this a known bug (patch available)?

--
+----------------------------------+----------------------------------+
| Daniel K. Forrest                | Laboratory for Molecular and     |

+----------------------------------+----------------------------------+

 
 
 

Solaris 8 NFS client problem with link and rename

Post by Kjetil Torgrim Homm » Wed, 27 Jun 2001 05:51:44


[Daniel Forrest]

Quote:>   I have found what I believe to be a bug in the Solaris 8 NFS
>   client.  After an upgrade from Solaris 5.6, one of our programs
>   began failing.  I have been able to reproduce the failure with the
>   following script:

Break out snoop and look at what goes over the wire.  (See at end.)

Quote:>   Has anyone seen this before?

I can confirm your test case on a Solaris 8 04/01 system (with
108727-04).  It works as you'd expect on Solaris 7.

Quote:>   Is this a known bug (patch available)?

The current NFS patch is 108727-06 (download it from
sunsolve.sun.com), but the bugs listed as fix doesn't seem to match
your problem.

Kjetil T.

--- nfs-trace-sol8      Mon Jun 25 22:35:47 2001
+++ nfs-trace-sol7      Mon Jun 25 22:36:49 2001
 client -> server NFS C LOOKUP3 FH=0C3F foobar
 server -> client NFS R LOOKUP3 No such file or directory
 client -> server NFS C LOOKUP3 FH=0C3F foobar.busy
 server -> client NFS R LOOKUP3 No such file or directory
 client -> server NFS C LOOKUP3 FH=0C3F client.2730.xopn
 server -> client NFS R LOOKUP3 No such file or directory
 client -> server NFS C GETATTR3 FH=0C3F
 server -> client NFS R GETATTR3 OK
-client -> server NFS_ACL C GETACL3 FH=0C3F mask=8
-server -> client NFS_ACL R GETACL3 OK
 client -> server NFS C LOOKUP3 FH=0C3F client.2730.xopn
 server -> client NFS R LOOKUP3 No such file or directory
 client -> server NFS C CREATE3 FH=0C3F (GUARDED) client.2730.xopn
 server -> client NFS R CREATE3 OK FH=D4CF
 client -> server NFS C GETATTR3 FH=0C3F
 server -> client NFS R GETATTR3 OK
 client -> server NFS C GETATTR3 FH=0C3F
 server -> client NFS R GETATTR3 OK
 client -> server NFS C GETATTR3 FH=0C3F
 server -> client NFS R GETATTR3 OK
 client -> server NFS C LINK3 FH=D4CF to FH=0C3F foobar.busy
 server -> client NFS R LINK3 OK
 client -> server NFS C LOOKUP3 FH=0C3F .nfs69D4
 server -> client NFS R LOOKUP3 No such file or directory
-client -> server NFS C LOOKUP3 FH=0C3F client.2730.xopn
-server -> client NFS R LOOKUP3 OK FH=D4CD
 client -> server NFS C RENAME3 FH=0C3F client.2730.xopn to FH=0C3F .nfs69D4
 server -> client NFS R RENAME3 OK
 client -> server NFS C LOOKUP3 FH=01C6 kjetilho
 server -> client NFS R LOOKUP3 OK FH=0C3F
 client -> server NFS C LOOKUP3 FH=0C3F bin
 server -> client NFS R LOOKUP3 OK FH=0C38
 client -> server NFS C ACCESS3 FH=0C3F (lookup)
 server -> client NFS R ACCESS3 OK (lookup)
 client -> server NFS C GETATTR3 FH=0C38
 server -> client NFS R GETATTR3 OK
 client -> server NFS C GETATTR3 FH=0C38
 server -> client NFS R GETATTR3 OK
 client -> server NFS C LOOKUP3 FH=0C3F foobar
 server -> client NFS R LOOKUP3 No such file or directory
 client -> server NFS C LOOKUP3 FH=0C3F foobar.busy
 server -> client NFS R LOOKUP3 OK FH=D4CF
 client -> server NFS C WRITE3 FH=D4CF at 0 for 33 (FSYNC)
 server -> client NFS R WRITE3 OK 33 (FSYNC)
 client -> server NFS C GETATTR3 FH=0C3F
 server -> client NFS R GETATTR3 OK
 client -> server NFS C GETATTR3 FH=0C3F
 server -> client NFS R GETATTR3 OK
 client -> server NFS C GETATTR3 FH=0C3F
 server -> client NFS R GETATTR3 OK
 client -> server NFS C RENAME3 FH=0C3F foobar.busy to FH=0C3F foobar
 server -> client NFS R RENAME3 OK
-client -> server NFS C REMOVE3 FH=0C3F foobar
+client -> server NFS C REMOVE3 FH=0C3F .nfs69D4
 server -> client NFS R REMOVE3 OK

See the minor difference at the end? :-)