From 56a222f9e764497bb29010bac7cf49230aed321b Mon Sep 17 00:00:00 2001 From: Gui Chen Date: Fri, 9 Aug 2013 04:42:53 -0400 Subject: [PATCH] remove myfuser to detect the instance the detection of .chroot.lock is not so correct in logic, if the .chroot.lock is used by another process, it works; if it is used by this process, it faults. so fuser is not working as expected here. also removing fuser will break a dependency of 'fuser' command Signed-off-by: Gui Chen --- mic/utils/fs_related.py | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/mic/utils/fs_related.py b/mic/utils/fs_related.py index b9b9a97..5802c27 100644 --- a/mic/utils/fs_related.py +++ b/mic/utils/fs_related.py @@ -88,23 +88,6 @@ def resize2fs(fs, size): else: return runner.show([resize2fs, fs, "%sK" % (size / 1024,)]) -def my_fuser(fp): - fuser = find_binary_path("fuser") - if not os.path.exists(fp): - return False - - rc = runner.quiet([fuser, "-s", fp]) - if rc == 0: - for pid in runner.outs([fuser, fp]).split(): - fd = open("/proc/%s/cmdline" % pid, "r") - cmdline = fd.read() - fd.close() - if cmdline[:-1] == "/bin/bash": - return True - - # not found - return False - class BindChrootMount: """Represents a bind mount of a directory into a chroot.""" def __init__(self, src, chroot, dest = None, option = None): @@ -134,10 +117,6 @@ class BindChrootMount: return False - def has_chroot_instance(self): - lock = os.path.join(self.root, ".chroot.lock") - return my_fuser(lock) - def mount(self): if self.mounted or self.ismounted(): return @@ -159,9 +138,6 @@ class BindChrootMount: os.symlink(self.src, dest) def unmount(self): - if self.has_chroot_instance(): - return - if self.ismounted(): runner.show([self.umountcmd, "-l", self.dest]) self.mounted = False -- 2.7.4