Commit b151999f authored by Ziye Yang's avatar Ziye Yang Committed by Changpeng Liu
Browse files

blobfs: Add the return value check for calling cache_append_buffer



Reason: We need to detect this issue. Otherwise, it will
cause null pointer issue later

Change-Id: I4d9aec0570e0b46274ebf3b9642b4727049a4a3b
Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448594


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 11b38a58
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -2142,10 +2142,11 @@ spdk_file_write(struct spdk_file *file, struct spdk_io_channel *_channel,
	pthread_spin_lock(&file->lock);
	file->open_for_writing = true;

	if (file->last == NULL) {
		if (file->append_pos % CACHE_BUFFER_SIZE == 0) {
	if ((file->last == NULL) && (file->append_pos % CACHE_BUFFER_SIZE == 0)) {
		cache_append_buffer(file);
		} else {
	}

	if (file->last == NULL) {
		int rc;

		file->append_pos += length;
@@ -2155,7 +2156,6 @@ spdk_file_write(struct spdk_file *file, struct spdk_io_channel *_channel,
		sem_wait(&channel->sem);
		return rc;
	}
	}

	blob_size = __file_get_blob_size(file);