bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Orphan the mountee.


From: Sergiu Ivanov
Subject: [PATCH] Orphan the mountee.
Date: Tue, 7 Jul 2009 17:10:44 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

>From 653c53ba519ddc0b9a338b3ac7548a84c1384f0b Mon Sep 17 00:00:00 2001
From: Sergiu Ivanov <unlimitedscolobb@gmail.com>
Date: Tue, 7 Jul 2009 13:34:32 +0000
Subject: [PATCH] Orphan the mountee.

* mount.c (start_mountee): Orphan the mountee immediately after
starting it.
(setup_unionmount): Drop the reference to the proxy node.
---
 mount.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/mount.c b/mount.c
index f9a5257..c361f20 100644
--- a/mount.c
+++ b/mount.c
@@ -160,6 +160,16 @@ start_mountee (node_t * np, char * argz, size_t argz_len, 
int flags,
      call.  */
   err = file_set_translator (underlying_port, 0, FS_TRANS_SET, 0, argz,
                             argz_len, control, MACH_MSG_TYPE_COPY_SEND);
+  if (err)
+    {
+      port_dealloc (underlying_port);
+      return err;
+    }
+
+  /* Attempt to orphan the mountee so that we don't need to keep its
+     underlying node alive.  */
+  err = file_set_translator (underlying_port, 0, FS_TRANS_SET | 
FS_TRANS_ORPHAN, 0,
+      NULL, 0, control, MACH_MSG_TYPE_COPY_SEND);
   port_dealloc (underlying_port);
   if (err)
     return err;
@@ -202,6 +212,9 @@ setup_unionmount (void)
   err = start_mountee (unionmount_proxy, mountee_argz,
                       mountee_argz_len, O_READ, &mountee_port);
 
+  /* Drop our reference to the no longer required proxy node.  */
+  netfs_nrele (unionmount_proxy);
+
   /* A path equal to "\0" will mean that the current ULFS entry is the
      mountee port.  */
   ulfs_register ("", 0, 0);
-- 
1.6.3.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]