FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Build System

 
 
LinkBack Thread Tools
 
Old 08-11-2010, 01:26 PM
Alan Franzoni
 
Default _umountall unmounts everything

Hello,
I had already submitted that to the bug tracker and I though it was
approved, but I think it didn't get applied:

http://fedorahosted.org/mock/ticket/4

I've got it updated to work with the current master and to solve an
issue with tmpfs as well. I'm attaching it as well.

this should address Paul Howarth patch 2/5 as well; it seems pointless
to me to reverse a structure and then reverse it again after using it,
it's better to have a copy of it reversed "on the fly" when using it.

BTW, Paul, how many times is _umountall() called in your code? I thought
it ought to be called just once!

--
Alan Franzoni
contact me at public@[mysurname].eu
diff --git a/py/mock/backend.py b/py/mock/backend.py
index eb97219..1a8c0bb 100644
--- a/py/mock/backend.py
+++ b/py/mock/backend.py
@@ -632,12 +632,26 @@ class Root(object):
decorate(traceLog())
def _umountall(self):
"""umount all mounted chroot fs."""
- # Unwind mounts by umounting in the opposite order of the mounts
- umountCmds = self.umountCmds
- umountCmds.reverse()
- for cmd in umountCmds:
+ # first try removing all expected mountpoints.
+ for cmd in self.umountCmds:
self.root_log.debug(cmd)
- mock.util.do(cmd, raiseExc=0, shell=True)
+ try:
+ mock.util.do(cmd, raiseExc=1, shell=True)
+ except mock.exception.Error, e:
+ # the exception already contains info about the error.
+ self.root_log.warning(e)
+ # then remove anything that might be left around.
+ mountpoints = open("/proc/mounts").read().strip().split("
")
+ # umount in reverse mount order to prevent nested mount issues that
+ # may prevent clean unmount.
+ for mountline in reversed(mountpoints):
+ mountpoint = mountline.split()[1]
+ if os.path.realpath(mountpoint).startswith(os.path.re alpath(
+ self.makeChrootPath() + "/")):
+ cmd = "umount -n %s" % mountpoint
+ self.root_log.warning("Forcibly unmounting '%s' from chroot." %
+ mountpoint)
+ mock.util.do(cmd, raiseExc=0, shell=True)

decorate(traceLog())
def _yum(self, cmd, returnOutput=0):
--
buildsys mailing list
buildsys@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/buildsys
 
Old 08-11-2010, 01:31 PM
Alan Franzoni
 
Default _umountall unmounts everything

On 8/11/10 3:26 PM, Alan Franzoni wrote:
[cut]

I now realized that Paul's concern was slightly different than my own,
but it can be addressed in the very same way using reversed(). An
updated patch has been loaded on the bugtracker and is attached here.



--
Alan Franzoni
contact me at public@[mysurname].eu
diff --git a/py/mock/backend.py b/py/mock/backend.py
index eb97219..a7b0c4b 100644
--- a/py/mock/backend.py
+++ b/py/mock/backend.py
@@ -632,12 +632,26 @@ class Root(object):
decorate(traceLog())
def _umountall(self):
"""umount all mounted chroot fs."""
- # Unwind mounts by umounting in the opposite order of the mounts
- umountCmds = self.umountCmds
- umountCmds.reverse()
- for cmd in umountCmds:
+ # first try removing all expected mountpoints.
+ for cmd in reversed(self.umountCmds):
self.root_log.debug(cmd)
- mock.util.do(cmd, raiseExc=0, shell=True)
+ try:
+ mock.util.do(cmd, raiseExc=1, shell=True)
+ except mock.exception.Error, e:
+ # the exception already contains info about the error.
+ self.root_log.warning(e)
+ # then remove anything that might be left around.
+ mountpoints = open("/proc/mounts").read().strip().split("
")
+ # umount in reverse mount order to prevent nested mount issues that
+ # may prevent clean unmount.
+ for mountline in reversed(mountpoints):
+ mountpoint = mountline.split()[1]
+ if os.path.realpath(mountpoint).startswith(os.path.re alpath(
+ self.makeChrootPath() + "/")):
+ cmd = "umount -n %s" % mountpoint
+ self.root_log.warning("Forcibly unmounting '%s' from chroot." %
+ mountpoint)
+ mock.util.do(cmd, raiseExc=0, shell=True)

decorate(traceLog())
def _yum(self, cmd, returnOutput=0):
--
buildsys mailing list
buildsys@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/buildsys
 
Old 08-11-2010, 02:03 PM
Paul Howarth
 
Default _umountall unmounts everything

On 11/08/10 14:26, Alan Franzoni wrote:
> Hello,
> I had already submitted that to the bug tracker and I though it was
> approved, but I think it didn't get applied:
>
> http://fedorahosted.org/mock/ticket/4
>
> I've got it updated to work with the current master and to solve an
> issue with tmpfs as well. I'm attaching it as well.
>
> this should address Paul Howarth patch 2/5 as well; it seems pointless
> to me to reverse a structure and then reverse it again after using it,
> it's better to have a copy of it reversed "on the fly" when using it.
>
> BTW, Paul, how many times is _umountall() called in your code? I thought
> it ought to be called just once!

First time is at the end of the "running yum" state, after setting up
the rpm build directories, and the second time is after copying the
build packages to the results directory.

Paul.
--
buildsys mailing list
buildsys@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/buildsys
 
Old 08-11-2010, 03:03 PM
Alan Franzoni
 
Default _umountall unmounts everything

On 8/11/10 4:03 PM, Paul Howarth wrote:
> First time is at the end of the "running yum" state, after setting up
> the rpm build directories, and the second time is after copying the
> build packages to the results directory.
>
> Paul.

Yes, I got it wrong the first time, I thought it addressed a different
concern. The second version of my patch includes a fix to your problem
as well.

Alan Franzoni



--
buildsys mailing list
buildsys@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/buildsys
 

Thread Tools




All times are GMT. The time now is 06:39 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org