From 756a5aced4342cb8cd99b6caa13a729ad6717fa0 Mon Sep 17 00:00:00 2001 From: benrubson Date: Fri, 17 Feb 2017 11:44:50 +0100 Subject: [PATCH] Improve log messages --- encfs/main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/encfs/main.cpp b/encfs/main.cpp index 19b5bfd..931d626 100644 --- a/encfs/main.cpp +++ b/encfs/main.cpp @@ -710,6 +710,11 @@ static void *idleMonitor(void *_arg) { const int timeoutCycles = 60 * arg->idleTimeout / ActivityCheckInterval; int idleCycles = -1; + bool unmountres = false; + + // We will notify when FS will be unmounted, so notify that it has just been mounted + RLOG(INFO) << "Filesystem mounted: " << arg->opts->mountPoint; + pthread_mutex_lock(&ctx->wakeupMutex); while (ctx->running) { @@ -723,7 +728,8 @@ static void *idleMonitor(void *_arg) { if (idleCycles >= timeoutCycles) { int openCount = ctx->openFileCount(); if (openCount == 0) { - if (unmountFS(ctx)) { + unmountres = unmountFS(ctx); + if (unmountres) { // wait for main thread to wake us up pthread_cond_wait(&ctx->wakeupCond, &ctx->wakeupMutex); break; @@ -747,6 +753,10 @@ static void *idleMonitor(void *_arg) { pthread_mutex_unlock(&ctx->wakeupMutex); + // If we are here FS has been unmounted, so if we did not unmount ourselves (manual, kill...), notify + if (!unmountres) + RLOG(INFO) << "Filesystem unmounted: " << arg->opts->mountPoint; + VLOG(1) << "Idle monitoring thread exiting"; return 0;