encode_fattr3(&wcc.after.post_op_attr_u.attributes, inode);
result.write3res_u.resok.file_wcc = wcc;
result.write3res_u.resok.count = argp->count;
- result.write3res_u.resok.committed = FILE_SYNC;
+ result.write3res_u.resok.committed = UNSTABLE;
+ memcpy(result.write3res_u.resok.verf,
+ nfsd_instance_verf_cookie, NFS3_WRITEVERFSIZE);
+
+ if (argp->stable != UNSTABLE) {
+ bluesky_inode_do_sync(inode);
+ result.write3res_u.resok.committed = FILE_SYNC;
+ }
- bluesky_inode_do_sync(inode);
g_mutex_unlock(inode->lock);
async_rpc_send_reply(req, &result);
result.commit3res_u.resok.file_wcc.after.present = TRUE;
encode_fattr3(&result.commit3res_u.resok.file_wcc.after.post_op_attr_u.attributes, inode);
+ memcpy(result.commit3res_u.resok.verf,
+ nfsd_instance_verf_cookie, NFS3_WRITEVERFSIZE);
g_mutex_unlock(inode->lock);
* filesystem. */
#include "mount_prot.h"
+#include "nfs3_prot.h"
#include <stdio.h>
#include <stdlib.h>
#include <rpc/pmap_clnt.h>
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");
store = bluesky_store_new(target);
fs = bluesky_init_fs("export", store);
+ bluesky_crypt_random_bytes(nfsd_instance_verf_cookie,
+ sizeof(nfsd_instance_verf_cookie));
+
register_rpc();
svc_run();