All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common: get fs type again using device canonical name in _fs_type
@ 2014-07-27 16:37 Eryu Guan
  2014-07-31 10:52 ` [PATCH v2] " Eryu Guan
  0 siblings, 1 reply; 7+ messages in thread
From: Eryu Guan @ 2014-07-27 16:37 UTC (permalink / raw)
  To: fstests; +Cc: Eryu Guan

When testing with lvm, a previous btrfsck run could change df output
from something like

/dev/mapper/rhel_hp--dl388eg8--01-testlv1 btrfs 15728640 900 13602172 1% /mnt/btrfs

to

/dev/dm-3 btrfs 15728640 900 13602172 1% /mnt/btrfs

So "_fs_type $device" couldn't find the mounted btrfs in
_check_btrfs_filesystem and the fs couldn't get unmounted, then a latter
btrfsck reports the btrfs is currently mounted, which could fail the test.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 common/rc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index 2c83340..a4fb21d 100644
--- a/common/rc
+++ b/common/rc
@@ -802,7 +802,13 @@ _fs_type()
     # Fix the filesystem type up here so that the callers don't
     # have to bother with this quirk.
     #
-    _df_device $1 | $AWK_PROG '{ print $2 }' | sed -e 's/nfs4/nfs/'
+    local fstype=`_df_device $1 | $AWK_PROG '{ print $2 }' | sed -e 's/nfs4/nfs/'`
+    # in case $device is a symlink(lvm) and df gives out the canonical name
+    if [ "$fstype" == "" ]; then
+        _df_device `_real_dev $1` | $AWK_PROG '{ print $2 }' | sed -e 's/nfs4/nfs/'`
+    else
+        echo $fstype
+    fi
 }
 
 # return the FS mount options of a mounted device
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-01  8:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-27 16:37 [PATCH] common: get fs type again using device canonical name in _fs_type Eryu Guan
2014-07-31 10:52 ` [PATCH v2] " Eryu Guan
2014-08-01  0:21   ` Dave Chinner
2014-08-01  4:02     ` Eryu Guan
2014-08-01  4:49       ` Dave Chinner
2014-08-01  5:02         ` Eryu Guan
2014-08-01  8:48           ` Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.