Merge commit 'ronnie/master'
authorAndrew Tridgell <tridge@samba.org>
Fri, 25 Jul 2008 07:15:07 +0000 (17:15 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 25 Jul 2008 07:15:07 +0000 (17:15 +1000)
loadfiles/nfs.txt
nfsio.c

index 7783b278b7cd91b55e4f5f997ee8759d5bd6cf34..6fe3dd27ffc62c30e3d6594928ecb9c3b8e943ce 100644 (file)
@@ -1,15 +1,13 @@
 # DELTREE if we want to delete the client directory everytime we restart 
-# the script. Remove these three lines if the script is only "read-only"
+# the script. Remove these two lines if the script is only "read-only"
 # reading from pre-existing files in the /clients/clientX/ tree
-0.000 LOOKUP3 "/clients" 0x00000000
 0.000 Deltree "/clients/client1" 0x00000000
 0.000 MKDIR3 "/clients/client1" 0x00000000
 #
-# These two lokups must be performed to pre-load the name to filehandle cache.
+# This this lookup must be performed to pre-load the name to filehandle cache.
 # Othervise we will get errors like this :
 #     failed to fetch handle in nfsio_read
 #
-0.000 LOOKUP3 "/clients" 0x00000000
 0.000 LOOKUP3 "/clients/client1" 0x00000000
 #
 # Here is where the script starts
diff --git a/nfsio.c b/nfsio.c
index e51ca18ae8919c1d780f5ca8329307ce1edfd840..c95f8c3519edff1db34add82cde1aba6fc7e6317 100644 (file)
--- a/nfsio.c
+++ b/nfsio.c
@@ -54,6 +54,7 @@ static void nfs3_cleanup(struct child_struct *child)
 static void nfs3_setup(struct child_struct *child)
 {
        const char *status = "0x00000000";
+       nfsstat3 res;
 
        child->rate.last_time = timeval_current();
        child->rate.last_bytes = 0;
@@ -67,6 +68,17 @@ static void nfs3_setup(struct child_struct *child)
                printf("nfsio_connect() failed\n");
                exit(10);
        }
+
+       /* create '/clients' */
+       res = nfsio_lookup(child->private, "/clients", NULL);
+       if (res == NFS3ERR_NOENT) {
+               res = nfsio_mkdir(child->private, "/clients");
+               if( (res != NFS3_OK) &&
+                   (res != NFS3ERR_EXIST) ) {
+                       printf("Failed to create '/clients' directory. res:%u\n", res);
+                       exit(10);
+               }
+       }
 }