module/blobfs: fix segmentation fault when fuse mount fail

if mountpoint doesn't exist, fuse mount will fail and @bfuse
will be null, blobfs_fuse_stop() try to access it without
check which cause segmentation finally.

Patch also improve test messages output to include
terminator properly.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Change-Id: Idba23e3922778f1985d1f4841a1701cdc272ef17
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3863
Community-CI: Mellanox Build Bot
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Wang Shilong 2020-08-20 15:06:29 +08:00 committed by Tomasz Zawadzki
parent 09d6e90a9a
commit 78ba12ecf4
2 changed files with 6 additions and 4 deletions

View File

@ -353,6 +353,8 @@ err:
void
blobfs_fuse_stop(struct spdk_blobfs_fuse *bfuse)
{
fuse_session_exit(fuse_get_session(bfuse->fuse_handle));
pthread_kill(bfuse->fuse_tid, SIGINT);
if (bfuse) {
fuse_session_exit(fuse_get_session(bfuse->fuse_handle));
pthread_kill(bfuse->fuse_tid, SIGINT);
}
}

View File

@ -56,7 +56,7 @@ static void
fuse_run_cb(void *cb_arg, int fserrno)
{
if (fserrno) {
printf("Failed to mount filesystem on bdev %s to path %s: %s",
printf("Failed to mount filesystem on bdev %s to path %s: %s\n",
g_bdev_name, g_mountpoint, spdk_strerror(fserrno));
spdk_app_stop(0);
@ -69,7 +69,7 @@ fuse_run_cb(void *cb_arg, int fserrno)
static void
spdk_fuse_run(void *arg1)
{
printf("Mounting filesystem on bdev %s to path %s...",
printf("Mounting filesystem on bdev %s to path %s...\n",
g_bdev_name, g_mountpoint);
fflush(stdout);