From: Michael Vrable Date: Thu, 15 Jul 2010 22:54:52 +0000 (-0700) Subject: Add synchronous inode logging in the NFS server. X-Git-Url: http://git.vrable.net/?p=bluesky.git;a=commitdiff_plain;h=c4eb30d2e6e577e424b83d4b5180d48af74e3009 Add synchronous inode logging in the NFS server. This is in preparation for adding inode logging for data durability. --- diff --git a/nfs3/nfs3.c b/nfs3/nfs3.c index a0102ef..2a5b789 100644 --- a/nfs3/nfs3.c +++ b/nfs3/nfs3.c @@ -208,6 +208,8 @@ void nfsproc3_setattr_3_svc(setattr3args *argp, RPCRequest *req) inode); result.status = NFS3_OK; + bluesky_inode_do_sync(inode); + g_mutex_unlock(inode->lock); async_rpc_send_reply(req, &result); } @@ -428,6 +430,7 @@ void nfsproc3_write_3_svc(write3args *argp, RPCRequest *req) result.write3res_u.resok.count = argp->count; result.write3res_u.resok.committed = FILE_SYNC; + bluesky_inode_do_sync(inode); g_mutex_unlock(inode->lock); async_rpc_send_reply(req, &result); @@ -499,6 +502,8 @@ void nfsproc3_create_3_svc(create3args *argp, RPCRequest *req) result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8; result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_val = (char *)&fh_bytes; + bluesky_inode_do_sync(file); + bluesky_inode_do_sync(dir); g_mutex_unlock(file->lock); g_mutex_unlock(dir->lock); @@ -572,6 +577,8 @@ void nfsproc3_mkdir_3_svc(mkdir3args *argp, RPCRequest *req) result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8; result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_val = (char *)&fh_bytes; + bluesky_inode_do_sync(file); + bluesky_inode_do_sync(dir); g_mutex_unlock(file->lock); g_mutex_unlock(dir->lock); async_rpc_send_reply(req, &result); @@ -643,6 +650,8 @@ void nfsproc3_symlink_3_svc(symlink3args *argp, RPCRequest *req) result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8; result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_val = (char *)&fh_bytes; + bluesky_inode_do_sync(file); + bluesky_inode_do_sync(dir); g_mutex_unlock(file->lock); g_mutex_unlock(dir->lock); async_rpc_send_reply(req, &result); @@ -693,6 +702,7 @@ void nfsproc3_remove_3_svc(diropargs3 *argp, RPCRequest *req) encode_fattr3(&result.wccstat3_u.wcc.after.post_op_attr_u.attributes, dir); + bluesky_inode_do_sync(dir); g_mutex_unlock(dir->lock); async_rpc_send_reply(req, &result); } @@ -760,6 +770,8 @@ void nfsproc3_rmdir_3_svc(diropargs3 *argp, RPCRequest *req) encode_fattr3(&result.wccstat3_u.wcc.after.post_op_attr_u.attributes, dir); + bluesky_inode_do_sync(dir); + bluesky_inode_do_sync(inode); g_mutex_unlock(inode->lock); g_mutex_unlock(dir->lock); async_rpc_send_reply(req, &result); @@ -809,6 +821,9 @@ void nfsproc3_rename_3_svc(rename3args *argp, RPCRequest *req) else result.status = NFS3ERR_PERM; + bluesky_inode_do_sync(dir2); + bluesky_inode_do_sync(dir1); + g_mutex_unlock(dir1->lock); if (dir1->inum != dir2->inum) g_mutex_unlock(dir2->lock); @@ -883,6 +898,8 @@ void nfsproc3_link_3_svc(link3args *argp, RPCRequest *req) encode_fattr3(&result.link3res_u.res.file_attributes.post_op_attr_u.attributes, inode); result.link3res_u.res.linkdir_wcc = wcc; + bluesky_inode_do_sync(inode); + bluesky_inode_do_sync(dir); g_mutex_unlock(inode->lock); g_mutex_unlock(dir->lock); async_rpc_send_reply(req, &result); @@ -1139,7 +1156,7 @@ void nfsproc3_commit_3_svc(commit3args *argp, RPCRequest *req) g_mutex_lock(inode->lock); encode_pre_wcc(&result.commit3res_u.resok.file_wcc, inode); - //bluesky_inode_do_sync(inode); + bluesky_inode_do_sync(inode); result.commit3res_u.resok.file_wcc.after.present = TRUE; encode_fattr3(&result.commit3res_u.resok.file_wcc.after.post_op_attr_u.attributes, inode);