loolwsd/LOOLKit.cpp |   22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

New commits:
commit 4ca15894dfb2cdbe0d25dd033f7eb90144a8ae73
Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
Date:   Fri Oct 14 23:04:12 2016 -0400

    loolwsd: only forkit cleans up the jail directory
    No need to do a partial cleanup in the kit
    when forkit recycles the disk. This avoid
    both programatic errors (as the comments in
    the removed code explains) as well as hammering
    the disk from multiple processes.
    By leaving all disk cleanup to forkit we
    guarantee safety and that only one process
    does disk cleanup, and sequentially at that.
    N.B. Kit processes are still responsible for
    setting up the jail and the LO binaries etc.
    So disk IO is not strictly sequential from a
    single process.
    Change-Id: Ia6768ab87df71a83a6676c3d52da3d6797f717fc
    Reviewed-on: https://gerrit.libreoffice.org/29944
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 172da5c..94e5a5a 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -1548,27 +1548,7 @@ void lokit_main(const std::string& childRoot,
                     return TerminationFlag.load();
-        // Clean up jail if we created one
-        if (bRunInsideJail && !jailPath.isRelative())
-        {
-            // In theory we should here do Util::removeFile("/", true), 
because we are inside the
-            // chroot jail, and all of it can be removed now when we are 
exiting. (At least the root
-            // of the chroot jail probably would not be removed even if we 
tried, so we still would
-            // need to complete the cleanup in loolforkit.)
-            // But: It is way too risky to actually do that (effectively, "rm 
-rf /") as it would
-            // trash a developer's machine if something goes wrong while 
hacking and debugging and
-            // the process isn't in a chroot after all when it comes here.
-            // So just remove what we can reasonably safely assume won't exist 
as global pathnames
-            // on a developer's machine, loSubpath (typically "/lo") and 
-            // ("/user/docs/").
-            Log::info("Removing '/" + loSubPath + "'");
-            Util::removeFile("/" + loSubPath, true);
-            Log::info("Removing '" + std::string(JAILED_DOCUMENT_ROOT) + "'");
-            Util::removeFile(std::string(JAILED_DOCUMENT_ROOT), true);
-        }
+        // Let forkit handle the jail cleanup.
     catch (const Exception& exc)
Libreoffice-commits mailing list

Reply via email to