From ebccbd4672947c51d87fc939b2da223df4b05448 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Wed, 31 Mar 2010 18:24:49 -0700 Subject: [PATCH] Fix filesystem locking when creating a new inode. --- nfs3/nfs3.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nfs3/nfs3.c b/nfs3/nfs3.c index 061f835..a0102ef 100644 --- a/nfs3/nfs3.c +++ b/nfs3/nfs3.c @@ -470,6 +470,7 @@ void nfsproc3_create_3_svc(create3args *argp, RPCRequest *req) return; } + g_mutex_lock(fs->lock); BlueSkyInode *file; file = bluesky_new_inode(bluesky_fs_alloc_inode(fs), fs, BLUESKY_REGULAR); file->nlink = 1; @@ -481,6 +482,7 @@ void nfsproc3_create_3_svc(create3args *argp, RPCRequest *req) file->ntime = time; g_mutex_lock(file->lock); bluesky_insert_inode(fs, file); + g_mutex_unlock(fs->lock); bluesky_directory_insert(dir, argp->where.name, file->inum); bluesky_inode_update_ctime(dir, TRUE); @@ -540,6 +542,7 @@ void nfsproc3_mkdir_3_svc(mkdir3args *argp, RPCRequest *req) return; } + g_mutex_lock(fs->lock); BlueSkyInode *file; file = bluesky_new_inode(bluesky_fs_alloc_inode(fs), fs, BLUESKY_DIRECTORY); file->nlink = 1; @@ -551,6 +554,7 @@ void nfsproc3_mkdir_3_svc(mkdir3args *argp, RPCRequest *req) file->ntime = time; g_mutex_lock(file->lock); bluesky_insert_inode(fs, file); + g_mutex_unlock(fs->lock); bluesky_directory_insert(dir, argp->where.name, file->inum); set_attributes(file, &argp->attributes); @@ -609,6 +613,7 @@ void nfsproc3_symlink_3_svc(symlink3args *argp, RPCRequest *req) return; } + g_mutex_lock(fs->lock); BlueSkyInode *file; file = bluesky_new_inode(bluesky_fs_alloc_inode(fs), fs, BLUESKY_SYMLINK); file->nlink = 1; @@ -621,6 +626,7 @@ void nfsproc3_symlink_3_svc(symlink3args *argp, RPCRequest *req) file->symlink_contents = g_strdup(argp->symlink.symlink_data); g_mutex_lock(file->lock); bluesky_insert_inode(fs, file); + g_mutex_unlock(fs->lock); bluesky_directory_insert(dir, argp->where.name, file->inum); bluesky_inode_update_ctime(dir, TRUE); -- 2.20.1