Commit e152aa8e authored by Ziye Yang's avatar Ziye Yang Committed by Jim Harris
Browse files

blobfs: add the check for buf allocation



If it fails to allocate the buf, we should conduct
the error handling.

Change-Id: If36b2dd84236052c777f5007ecbf7295e1c1d3eb
Signed-off-by: default avatarZiye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/420334


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent f6c5e40a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1608,6 +1608,13 @@ __readwrite(struct spdk_file *file, struct spdk_io_channel *_channel,
	__get_page_parameters(file, offset, length, &start_page, &page_size, &num_pages);
	pin_buf_length = num_pages * page_size;
	args->op.rw.pin_buf = spdk_dma_malloc(pin_buf_length, 4096, NULL);
	if (args->op.rw.pin_buf == NULL) {
		SPDK_DEBUGLOG(SPDK_LOG_BLOBFS, "Failed to allocate buf for: file=%s offset=%jx length=%jx\n",
			      file->name, offset, length);
		free_fs_request(req);
		cb_fn(cb_arg, -ENOMEM);
		return;
	}

	args->op.rw.start_page = start_page;
	args->op.rw.num_pages = num_pages;