The current code can't handle unmounting of partition objects
backed by files, such as:

partition = job.partition(device='/tmp/looped', loop_size=1024,
                          mountpoint=job.tmpdir)

Because the code that looks for mountpoint forgets to take
into account that the device in such cases is /dev/loopX.
So instead of only looking for the first field of /etc/mtab
or /proc/mounts, also look the second field to see if matches
the specified mountpoint.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/bin/partition.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/bin/partition.py b/client/bin/partition.py
index e238373..fd4c74e 100644
--- a/client/bin/partition.py
+++ b/client/bin/partition.py
@@ -496,7 +496,7 @@ class partition(object):
         if filename:
             for line in open_func(filename).readlines():
                 parts = line.split()
-                if parts[0] == self.device:
+                if parts[0] == self.device or parts[1] == self.mountpoint:
                     return parts[1] # The mountpoint where it's mounted
             return None
 
-- 
1.7.2.3

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to