test/blobfs: fix the heap-use-after-free issue

When testing fuse with blobfs, we used "bs=4k count=32" as the test case,
but when it comes to bdev layer, the IO size is 64KiB, and alignment is 4KiB,
so bdev_io_get_buf() will return error as the following message:

bdev.c: 789:bdev_io_get_buf: *ERROR*: Length + alignment 69632 is larger than allowed

so here we can resize the AIO alignment size from 4096 to 512, because the bdev memory
pool default alignment size is 512, with this change the error will not occur in
bdev layer.

For the umount operation, since the fuse module will use send message to do the umount,
here we can insert one second barrier to wait for the umount to be completed before
killing the process.

Fix issue #1406.

Change-Id: Id3c67900c87a5797718c28c184a925275f90c7d4
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2587
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Changpeng Liu 2020-05-25 01:19:02 -04:00 committed by Tomasz Zawadzki
parent b8ac3e8acd
commit 4d4766b716

View File

@ -101,6 +101,7 @@ function blobfs_fuse_test() {
dd if=/dev/urandom of=${mount_dir}/rand_file bs=4k count=32 dd if=/dev/urandom of=${mount_dir}/rand_file bs=4k count=32
umount ${mount_dir} umount ${mount_dir}
sleep 1
killprocess $blobfs_pid killprocess $blobfs_pid
# Verify there is no file in mount dir now # Verify there is no file in mount dir now
@ -117,6 +118,7 @@ function blobfs_fuse_test() {
rm ${mount_dir}/rand_file rm ${mount_dir}/rand_file
umount ${mount_dir} umount ${mount_dir}
sleep 1
killprocess $blobfs_pid killprocess $blobfs_pid
} }
@ -125,7 +127,7 @@ trap 'cleanup' EXIT
# Create one temp file as test bdev # Create one temp file as test bdev
dd if=/dev/zero of=${tmp_file} bs=4k count=1M dd if=/dev/zero of=${tmp_file} bs=4k count=1M
echo "[AIO]" > ${conf_file} echo "[AIO]" > ${conf_file}
echo "AIO ${tmp_file} ${bdevname} 4096" >> ${conf_file} echo "AIO ${tmp_file} ${bdevname} 512" >> ${conf_file}
blobfs_detect_test blobfs_detect_test