public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Cedric Hombourger <Cedric_Hombourger@mentor.com>
To: <isar-users@googlegroups.com>
Subject: [PATCH 1/1] isar-events: try unmounting all mounts before returning an error
Date: Wed, 7 Mar 2018 11:00:49 +0000	[thread overview]
Message-ID: <20180307110049.43760-2-Cedric_Hombourger@mentor.com> (raw)
In-Reply-To: <20180307110049.43760-1-Cedric_Hombourger@mentor.com>

Isar would loop forever if a mount cannot be unmounted because another
bind mount was done underneath it (e.g. <basedir>/sys/devices on top
of <basedir>/sys). Increase of chances of success by trying to unmount
everything before returning an error. In the <basedir>/sys/dev case,
we may try <basedir>/sys first and fail but would continue to unmount
<basedir>/sys/dev. On the following call, only <basedir>/sys will remain
and the unmount_all should now succeed. We may want to implement a
timeout: e.g. giveup after 30 tries (i.e. approximately 30 seconds)?

Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
---
 meta/classes/isar-events.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/classes/isar-events.bbclass b/meta/classes/isar-events.bbclass
index 29c7437..b3ce434 100644
--- a/meta/classes/isar-events.bbclass
+++ b/meta/classes/isar-events.bbclass
@@ -14,14 +14,15 @@ python isar_handler () {
         # '/proc/mounts' contains all the active mounts, so knowing basepath
         # we can get the list of mounts for the specific multiconfig and
         # clean them.
+        result = True
         with open('/proc/mounts', 'rU') as f:
             for line in f:
                 if basepath in line:
                     if subprocess.call('sudo umount ' + line.split()[1],
                                        stdout=devnull, stderr=devnull,
                                        shell=True) != 0:
-                        return False
-        return True
+                        result = False
+        return result
 
     devnull = open(os.devnull, 'w')
 
-- 
2.11.0


  reply	other threads:[~2018-03-07 11:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 11:00 [PATCH 0/1] " Cedric Hombourger
2018-03-07 11:00 ` Cedric Hombourger [this message]
2018-03-07 11:24   ` [PATCH 1/1] isar-events: " Jan Kiszka
2018-03-07 11:34     ` Hombourger, Cedric
2018-03-07 11:58       ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180307110049.43760-2-Cedric_Hombourger@mentor.com \
    --to=cedric_hombourger@mentor.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox