Message ID | 20220506150141.333929-1-ridave@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [PATCHv2] cephfs: add ceph-fuse suport for ceph-fuse | expand |
On Fri, May 06, 2022 at 08:31:42PM +0530, Rishabh Dave wrote: > Currently tests in xfstests-dev can be executed against CephFS only by > mounting CephFS using kernel driver. Attempting to run tests against > CephFS using FUSE doesn't work because xfstests-dev would remount CephFS > using kernel. This patch adds the ability for xfstest-dev code to mount > CephFS using FUSE. > > Fixes: https://tracker.ceph.com/issues/55354 > Signed-off-by: Rishabh Dave <ridave@redhat.com> > --- This patch has been merged, refer to 1dac95cb ("cephfs: add ceph-fuse suport for ceph-fuse") in fstests for-next branch. And I've helped to fix that ";;" missing problem. The release [ANNOUNCE] is: https://lore.kernel.org/fstests/20220430190921.7BC56C385A7@smtp.kernel.org/ If you need to fix more issues, please write new patch base on the latest fstests for-next branch. Thanks, Zorro > common/config | 2 ++ > common/rc | 47 +++++++++++++++++++++++++++++++++++------------ > 2 files changed, 37 insertions(+), 12 deletions(-) > > diff --git a/common/config b/common/config > index 1033b890..efcf12e9 100644 > --- a/common/config > +++ b/common/config > @@ -556,6 +556,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 553ae350..a8252c7f 100644 > --- a/common/rc > +++ b/common/rc > @@ -500,10 +500,14 @@ _test_mount() > { > local mount_ret > > - 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 > mount_ret=$? > @@ -1446,7 +1450,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 > @@ -1595,6 +1600,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 > @@ -1608,16 +1631,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 > @@ -1870,6 +1891,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 > @@ -3204,7 +3227,7 @@ _check_test_fs() > virtiofs) > # no way to check consistency for virtiofs > ;; > - ceph) > + ceph|ceph-fuse) > # no way to check consistency for CephFS > ;; > glusterfs) > -- > 2.34.1 >
On Sat, 7 May 2022 at 13:00, Zorro Lang <zlang@redhat.com> wrote: > > This patch has been merged, refer to 1dac95cb ("cephfs: add ceph-fuse suport > for ceph-fuse") in fstests for-next branch. And I've helped to fix that ";;" > missing problem. > > The release [ANNOUNCE] is: > https://lore.kernel.org/fstests/20220430190921.7BC56C385A7@smtp.kernel.org/ > > If you need to fix more issues, please write new patch base on the latest > fstests for-next branch. > Okay. Thanks for the fix and thanks for the merge. Is merging in the for-next branch as good as merging in the master? Or should I watch out for my commit until it merges in master?
On Sat, May 07, 2022 at 01:26:20PM +0530, Rishabh Dave wrote: > On Sat, 7 May 2022 at 13:00, Zorro Lang <zlang@redhat.com> wrote: > > > > This patch has been merged, refer to 1dac95cb ("cephfs: add ceph-fuse suport > > for ceph-fuse") in fstests for-next branch. And I've helped to fix that ";;" > > missing problem. > > > > The release [ANNOUNCE] is: > > https://lore.kernel.org/fstests/20220430190921.7BC56C385A7@smtp.kernel.org/ > > > > If you need to fix more issues, please write new patch base on the latest > > fstests for-next branch. > > > > Okay. Thanks for the fix and thanks for the merge. > > Is merging in the for-next branch as good as merging in the master? Or > should I watch out for my commit until it merges in master? fstests for-next is an offical branch with PGP signed release version tag, feel free to prioritize using it. The master branch will be 1~2 weeks later than for-next, to keep the stability of it. So for-next is fresher, master trys to be slower and stabler. I explained in last [ANNOUNCE] email [1]. Thanks, Zorro [1] https://lore.kernel.org/fstests/20220430190921.7BC56C385A7@smtp.kernel.org/ >
diff --git a/common/config b/common/config index 1033b890..efcf12e9 100644 --- a/common/config +++ b/common/config @@ -556,6 +556,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 553ae350..a8252c7f 100644 --- a/common/rc +++ b/common/rc @@ -500,10 +500,14 @@ _test_mount() { local mount_ret - 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 mount_ret=$? @@ -1446,7 +1450,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 @@ -1595,6 +1600,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 @@ -1608,16 +1631,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 @@ -1870,6 +1891,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 @@ -3204,7 +3227,7 @@ _check_test_fs() virtiofs) # no way to check consistency for virtiofs ;; - ceph) + ceph|ceph-fuse) # no way to check consistency for CephFS ;; glusterfs)
Currently tests in xfstests-dev can be executed against CephFS only by mounting CephFS using kernel driver. Attempting to run tests against CephFS using FUSE doesn't work because xfstests-dev would remount CephFS using kernel. This patch adds the ability for xfstest-dev code to mount CephFS using FUSE. Fixes: https://tracker.ceph.com/issues/55354 Signed-off-by: Rishabh Dave <ridave@redhat.com> --- common/config | 2 ++ common/rc | 47 +++++++++++++++++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 12 deletions(-)