summaryrefslogtreecommitdiffstats
path: root/xlators/mount
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-10-29 09:09:15 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-29 09:32:29 -0700
commit6e2dba2c418cd09206b390fad0f413fc287b93ee (patch)
tree535a7d5e4d948ca03f128da491f60689bfcfecd9 /xlators/mount
parentc555dcbb3a41f47149035c1d9ea95f67812db8c8 (diff)
protocol/server, mount/fuse: Handle returned inode in create properly
Check if linked_inode is different from returned inode in create, and if so, make the fd point to the correct inode. Signed-off-by: Vikas Gorur <vikas@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 347 (Assertion failed: inode->ref) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=347
Diffstat (limited to 'xlators/mount')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index b8a91fa0a..5e7e1f4d4 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -1677,22 +1677,29 @@ fuse_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
buf->st_blksize = this->ctx->page_size;
stat2attr (buf, &feo.attr);
- inode_link (inode, state->loc.parent,
- state->loc.name, buf);
- linked_inode = inode;
+ linked_inode = inode_link (inode, state->loc.parent,
+ state->loc.name, buf);
if (linked_inode != inode) {
- gf_log ("glusterfs-fuse", GF_LOG_ERROR,
+ gf_log ("glusterfs-fuse", GF_LOG_DEBUG,
"create(%s) inode (ptr=%p, ino=%"PRId64", "
"gen=%"PRId64") found conflict (ptr=%p, "
"ino=%"PRId64", gen=%"PRId64")",
state->loc.path, inode, inode->ino,
inode->generation, linked_inode,
linked_inode->ino, linked_inode->generation);
+
+ /*
+ VERY racy code (if used anywhere else)
+ -- don't do this without understanding
+ */
+ inode_unref (fd->inode);
+ fd->inode = inode_ref (linked_inode);
}
- inode_unref (linked_inode);
- inode_lookup (inode);
+ inode_lookup (linked_inode);
+
+ inode_unref (linked_inode);
fd_ref (fd);