Hi, Currently tests from xfstests-dev can be executed against CephFS mounted using the kernel but not mounted using FUSE. This is so because right now xfstests-dev doesn't know how to mount CephFS with FUSE. I've written a patch (attached to this e-mail) that adds the ability to xfstests-dev to mount CephFS with FUSE as well. I've tested the patch against Ceph's master branch. The patch works fine IMO because after applying the patch I could run tests against kernel-mounted as well as FUSE-mounted CephFS. I am not sure about the review process for xfstests-dev, please let me know if the patches need to be uploaded elsewhere. Thanks in advance. Regards, - Rishabh
diff --git a/common/config b/common/config index e0a5c5df..186e0e9a 100644 --- a/common/config +++ b/common/config @@ -547,6 +547,8 @@ _check_device() _fatal "common/config: $name ($dev) is not a character device" fi ;; + ceph-fuse) + ;; *) _fatal "common/config: $name ($dev) is not a block device or a network filesystem" esac diff --git a/common/rc b/common/rc index 7973ceb5..a58935af 100644 --- a/common/rc +++ b/common/rc @@ -446,10 +446,14 @@ _scratch_shutdown_handle() _test_mount() { - if [ "$FSTYP" == "overlay" ]; then + if [ "$FSTYP" == "ceph-fuse" ]; then + $CEPH_FUSE_BIN_PATH $TEST_FS_MOUNT_OPTS $TEST_DIR 2> /dev/null + return $? + elif [ "$FSTYP" == "overlay" ]; then _overlay_test_mount $* return $? fi + _test_options mount _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR } @@ -1386,7 +1390,8 @@ _fs_type() # have to bother with this quirk. # _df_device $1 | $AWK_PROG '{ print $2 }' | \ - sed -e 's/nfs4/nfs/' -e 's/fuse.glusterfs/glusterfs/' + sed -e 's/nfs4/nfs/' -e 's/fuse.glusterfs/glusterfs/' \ + -e 's/fuse.ceph-fuse/ceph-fuse/' } # return the FS mount options of a mounted device @@ -1535,6 +1540,24 @@ _supported_fs() _notrun "not suitable for this filesystem type: $FSTYP" } +_check_if_dev_already_mounted() +{ + local dev=$1 + local mnt=$2 + + # find $dev as the source, and print result in "$dev $mnt" format + local mount_rec=`findmnt -rncv -S $dev -o SOURCE,TARGET` + [ -n "$mount_rec" ] || return 1 # 1 = not mounted + + # if it's mounted, make sure its on $mnt + if [ "$mount_rec" != "$dev $mnt" ]; then + echo "$devname=$dev is mounted but not on $mntname=$mnt - aborting" + echo "Already mounted result:" + echo $mount_rec + return 2 # 2 = mounted on wrong mnt + fi +} + # check if a FS on a device is mounted # if so, verify that it is mounted on mount point # if fstype is given as argument, verify that it is also @@ -1548,16 +1571,14 @@ _check_mounted_on() local mnt=$4 local type=$5 - # find $dev as the source, and print result in "$dev $mnt" format - local mount_rec=`findmnt -rncv -S $dev -o SOURCE,TARGET` - [ -n "$mount_rec" ] || return 1 # 1 = not mounted + # this check doesn't work on ceph-fuse + if [ "$dev" != "ceph-fuse" ]; then + _check_if_dev_already_mounted $dev $mnt + dev_already_mounted=$? - # if it's mounted, make sure its on $mnt - if [ "$mount_rec" != "$dev $mnt" ]; then - echo "$devname=$dev is mounted but not on $mntname=$mnt - aborting" - echo "Already mounted result:" - echo $mount_rec - return 2 # 2 = mounted on wrong mnt + if [ $dev_already_mounted -ne 0 ]; then + return $dev_already_mounted + fi fi if [ -n "$type" -a "`_fs_type $dev`" != "$type" ]; then @@ -1779,6 +1800,8 @@ _require_test() _notrun "this test requires a valid \$TEST_DIR" fi ;; + ceph-fuse) + ;; cifs) echo $TEST_DEV | grep -q "//" > /dev/null 2>&1 if [ -z "$TEST_DEV" -o "$?" != "0" ]; then @@ -3112,7 +3135,7 @@ _check_test_fs() virtiofs) # no way to check consistency for virtiofs ;; - ceph) + ceph|ceph-fuse) # no way to check consistency for CephFS ;; glusterfs)