summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/Client.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/client/Client.cc b/src/client/Client.cc
index 213b78465d4..1b2a209c5cc 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -2975,8 +2975,10 @@ Dentry* Client::link(Dir *dir, const string& name, Inode *in, Dentry *dn)
}
if (in) { // link to inode
+ InodeRef tmp_ref;
// only one parent for directories!
if (in->is_dir() && !in->dentries.empty()) {
+ tmp_ref = in; // prevent unlink below from freeing the inode.
Dentry *olddn = in->get_first_parent();
assert(olddn->dir != dir || olddn->name != name);
Inode *old_diri = olddn->dir->parent_inode;