Implement handling of unstable data in WRITE/COMMIT nfs procedures.
[bluesky.git] / nfs3 / nfsd.c
index fc1f955..8641a56 100644 (file)
@@ -10,6 +10,7 @@
  * filesystem. */
 
 #include "mount_prot.h"
+#include "nfs3_prot.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <rpc/pmap_clnt.h>
@@ -26,6 +27,10 @@ void register_rpc();
 BlueSkyFS *fs;
 BlueSkyStore *store;
 
+/* A cookie value returned for uncommitted writes and verified by commits; this
+ * should be a unique value each time the server is started. */
+char nfsd_instance_verf_cookie[NFS3_WRITEVERFSIZE];
+
 static void shutdown_handler(int num)
 {
     g_print("SIGINT caught, shutting down...\n");
@@ -51,9 +56,10 @@ int main(int argc, char *argv[])
     store = bluesky_store_new(target);
     fs = bluesky_init_fs("export", store);
 
-    register_rpc();
+    bluesky_crypt_random_bytes(nfsd_instance_verf_cookie,
+                               sizeof(nfsd_instance_verf_cookie));
 
-    bluesky_debug_dump(fs);
+    register_rpc();
 
     svc_run();
     fprintf(stderr, "%s", "svc_run returned");