Fix un-necessary mount on XFS
authorJamie Cameron <jcameron@webmin.com>
Thu, 18 Mar 2010 16:56:37 +0000 (09:56 -0700)
committerJamie Cameron <jcameron@webmin.com>
Thu, 18 Mar 2010 16:56:37 +0000 (09:56 -0700)
lvm/lvm-lib.pl

index e11c5b2..3219c7c 100755 (executable)
@@ -544,18 +544,23 @@ elsif ($_[1] eq "xfs") {
        return $err if ($err);
 
        # Resize the filesystem .. which must be mounted!
+       local @stat = &device_status($_[0]->{'device'});
        local ($m, $mount);
-       foreach $m (&mount::list_mounts()) {
-               if ($m->[1] eq $_[0]->{'device'}) {
-                       $mount = $m;
+       if (!$stat[2]) {
+               foreach $m (&mount::list_mounts()) {
+                       if ($m->[1] eq $_[0]->{'device'}) {
+                               $mount = $m;
+                               }
                        }
+               $mount || return "Mount not found";
+               &mount::mount_dir(@$mount);
                }
-       $mount || return "Mount not found";
-       &mount::mount_dir(@$mount);
        local $cmd = "xfs_growfs ".quotemeta($mount->[0]);
        local $out = &backquote_logged("$cmd 2>&1");
        local $q = $?;
-       &mount::unmount_dir(@$mount);
+       if (!$stat[2]) {
+               &mount::unmount_dir(@$mount);
+               }
        return $q ? $out : undef;
        }
 elsif ($_[1] eq "reiserfs") {