diff options
| -rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 19 | ||||
| -rw-r--r-- | xlators/protocol/server/src/server-protocol.c | 19 | 
2 files changed, 32 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); diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 1939d07f6..628609500 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);  | 
