# 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
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;
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);
+ }
+ }
}