common/rc: introduce _overlay_mount_dirs helper

Introduce a new _overlay_mount_dirs() helper to do the actual
overlay mount operation and factor _overlay_scratch_mount and
_overlay_mount code to use a single implemention of
_overlay_mount_dirs(). Also convert all bare mount of overlay in
tests to use it.

Suggested-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eryu Guan
2016-08-09 15:28:47 +08:00
parent 115563d150
commit 3e3b49c61a
3 changed files with 18 additions and 13 deletions
+1 -4
View File
@@ -93,10 +93,7 @@ $XFS_IO_PROG -f -c "truncate 48m" ${lowerd}/test_file \
>>$seqres.full 2>&1
# mount new overlayfs
$MOUNT_PROG -t overlay $SELINUX_MOUNT_OPTIONS \
-o lowerdir=$lowerd -o upperdir=$upperd \
-o workdir=$workd \
$SCRATCH_DEV $SCRATCH_MNT
_overlay_mount_dirs $lowerd $upperd $workd $SCRATCH_DEV $SCRATCH_MNT
# the open call triggers copy-up and it will fail ENOSPC
$XFS_IO_PROG -f -c "o" ${SCRATCH_MNT}/test_file \
+2 -3
View File
@@ -67,9 +67,8 @@ touch $lowerdir1/testdir/a $lowerdir1/testdir/b
mknod $lowerdir2/testdir/a c 0 0
# Mount overlayfs and remove testdir, which led to kernel crash
$MOUNT_PROG -t overlay -o lowerdir=$lowerdir2:$lowerdir1 \
-o upperdir=$upperdir,workdir=$workdir \
$SCRATCH_DEV $SCRATCH_MNT
_overlay_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir \
$SCRATCH_DEV $SCRATCH_MNT
rm -rf $SCRATCH_MNT/testdir
# success, all done