summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdiskfs/file-reparent.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libdiskfs/file-reparent.c b/libdiskfs/file-reparent.c
index 83b4b309..bef01fac 100644
--- a/libdiskfs/file-reparent.c
+++ b/libdiskfs/file-reparent.c
@@ -43,7 +43,7 @@ diskfs_S_file_reparent (struct protid *cred, mach_port_t parent,
if (! err)
{
/* Remove old shadow root state. */
- if (new_cred->po->shadow_root)
+ if (new_cred->po->shadow_root && new_cred->po->shadow_root != node)
{
mutex_lock (&new_cred->po->shadow_root->lock);
diskfs_nput (new_cred->po->shadow_root);
@@ -53,7 +53,6 @@ diskfs_S_file_reparent (struct protid *cred, mach_port_t parent,
/* And install PARENT instead. */
new_cred->po->shadow_root = node;
- diskfs_nref (node);
new_cred->po->shadow_root_parent = parent;
*new = ports_get_right (new_cred);