From 6e2dba2c418cd09206b390fad0f413fc287b93ee Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Thu, 29 Oct 2009 09:09:15 +0000 Subject: 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 Signed-off-by: Anand V. Avati BUG: 347 (Assertion failed: inode->ref) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=347 --- xlators/protocol/server/src/server-protocol.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'xlators/protocol') diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 1939d07f687..628609500e1 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -1825,6 +1825,25 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); + + if (link_inode != inode) { + gf_log (this->name, 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, link_inode, + link_inode->ino, link_inode->generation); + + /* + VERY racy code (if used anywhere else) + -- don't do this without understanding + */ + + inode_unref (fd->inode); + fd->inode = inode_ref (link_inode); + } + inode_lookup (link_inode); inode_unref (link_inode); -- cgit